lt sync 1710

This commit is contained in:
Marcos Pinto 2007-10-31 02:00:53 +00:00
parent 15d39eeb54
commit 2a9455e50a
5 changed files with 15 additions and 9 deletions

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_INTRUSIVE_PTR_BASE
#include <boost/detail/atomic_count.hpp>
#include <boost/checked_delete.hpp>
#include "libtorrent/config.hpp"
#include "libtorrent/assert.hpp"
@ -60,7 +61,7 @@ namespace libtorrent
TORRENT_ASSERT(s->m_refs > 0);
TORRENT_ASSERT(s != 0);
if (--s->m_refs == 0)
delete static_cast<T const*>(s);
boost::checked_delete(static_cast<T const*>(s));
}
boost::intrusive_ptr<T> self()

View File

@ -57,6 +57,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/peer_request.hpp"
#include "libtorrent/hasher.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/buffer.hpp"
namespace libtorrent
{
@ -344,8 +345,8 @@ namespace libtorrent
// used to move pieces while expanding
// the storage from compact allocation
// to full allocation
std::vector<char> m_scratch_buffer;
std::vector<char> m_scratch_buffer2;
buffer m_scratch_buffer;
buffer m_scratch_buffer2;
// the piece that is in the scratch buffer
int m_scratch_piece;

View File

@ -190,6 +190,8 @@ namespace libtorrent
void broadcast_socket::close()
{
m_on_receive.clear();
for (std::list<socket_entry>::iterator i = m_sockets.begin()
, end(m_sockets.end()); i != end; ++i)
{

View File

@ -2122,8 +2122,8 @@ namespace detail
entry session_impl::dht_state() const
{
TORRENT_ASSERT(m_dht);
mutex_t::scoped_lock l(m_mutex);
if (!m_dht) return entry();
return m_dht->state();
}

View File

@ -99,6 +99,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <windows.h>
#include <boost/filesystem/exception.hpp>
#include "libtorrent/utf8.hpp"
#include "libtorrent/buffer.hpp"
namespace libtorrent
{
@ -386,7 +387,7 @@ namespace libtorrent
file_pool& m_files;
// temporary storage for moving pieces
std::vector<char> m_scratch_buffer;
buffer m_scratch_buffer;
};
sha1_hash storage::hash_for_slot(int slot, partial_hash& ph, int piece_size)
@ -468,14 +469,14 @@ namespace libtorrent
void storage::release_files()
{
m_files.release(this);
std::vector<char>().swap(m_scratch_buffer);
buffer().swap(m_scratch_buffer);
}
void storage::delete_files()
{
// make sure we don't have the files open
m_files.release(this);
std::vector<char>().swap(m_scratch_buffer);
buffer().swap(m_scratch_buffer);
// delete the files from disk
std::set<std::string> directories;
@ -975,6 +976,7 @@ namespace libtorrent
, m_storage_mode(storage_mode_sparse)
, m_info(ti)
, m_save_path(complete(save_path))
, m_state(state_none)
, m_current_slot(0)
, m_out_of_place(false)
, m_scratch_piece(-1)
@ -1622,8 +1624,8 @@ namespace libtorrent
if (m_current_slot == m_info->num_pieces())
{
m_state = state_create_files;
std::vector<char>().swap(m_scratch_buffer);
std::vector<char>().swap(m_scratch_buffer2);
buffer().swap(m_scratch_buffer);
buffer().swap(m_scratch_buffer2);
if (m_storage_mode != storage_mode_compact)
{
std::vector<int>().swap(m_piece_to_slot);