summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2009-01-25 02:51:01 +0000
committerAndrew Resch <andrewresch@gmail.com>2009-01-25 02:51:01 +0000
commit6847db13046f1d97b5e1f51676b63a5a6b82bb72 (patch)
tree6f0db79ce8fa7b10cd7d488660685e11abedb681
parente8d75cffe3f317f8d40966fc6fe83eb6e801eb82 (diff)
downloaddeluge-6847db13046f1d97b5e1f51676b63a5a6b82bb72.tar.gz
deluge-6847db13046f1d97b5e1f51676b63a5a6b82bb72.tar.bz2
deluge-6847db13046f1d97b5e1f51676b63a5a6b82bb72.zip
ltsync 3211
-rw-r--r--libtorrent/src/file_pool.cpp4
-rwxr-xr-xlibtorrent/src/peer_connection.cpp12
2 files changed, 14 insertions, 2 deletions
diff --git a/libtorrent/src/file_pool.cpp b/libtorrent/src/file_pool.cpp
index ef7ccca0d..d31930cce 100644
--- a/libtorrent/src/file_pool.cpp
+++ b/libtorrent/src/file_pool.cpp
@@ -57,8 +57,8 @@ namespace libtorrent
lru_file_entry e = *i;
e.last_use = time_now();
- if (e.key != st && ((e.mode & file::rw_mask) != file::read_only
- || (m & file::rw_mask) != file::read_only))
+ if (e.key != st && (e.mode != file::in
+ || m != file::in))
{
// this means that another instance of the storage
// is using the exact same file.
diff --git a/libtorrent/src/peer_connection.cpp b/libtorrent/src/peer_connection.cpp
index 81a8afd5f..92037a924 100755
--- a/libtorrent/src/peer_connection.cpp
+++ b/libtorrent/src/peer_connection.cpp
@@ -2549,6 +2549,10 @@ namespace libtorrent
error_code ec;
m_socket->close(ec);
m_ses.close_connection(this, message);
+
+ // we should only disconnect while we still have
+ // at least one reference left to the connection
+ TORRENT_ASSERT(refcount() > 0);
}
void peer_connection::set_upload_limit(int limit)
@@ -3507,6 +3511,10 @@ namespace libtorrent
INVARIANT_CHECK;
+ // keep ourselves alive in until this function exits in
+ // case we disconnect
+ boost::intrusive_ptr<peer_connection> me(self());
+
TORRENT_ASSERT(m_channel_state[download_channel] == peer_info::bw_network);
m_channel_state[download_channel] = peer_info::bw_idle;
@@ -3774,6 +3782,10 @@ namespace libtorrent
INVARIANT_CHECK;
+ // keep ourselves alive in until this function exits in
+ // case we disconnect
+ boost::intrusive_ptr<peer_connection> me(self());
+
TORRENT_ASSERT(m_channel_state[upload_channel] == peer_info::bw_network);
m_send_buffer.pop_front(bytes_transferred);