fixed connection setup and teardown issues

This commit is contained in:
Arvid Norberg 2011-10-28 23:34:55 +00:00
parent b85727c633
commit ec80a85bdb
1 changed files with 5 additions and 2 deletions

View File

@ -4587,6 +4587,8 @@ namespace libtorrent
void peer_connection::setup_send() void peer_connection::setup_send()
{ {
if (m_disconnecting) return;
if (m_channel_state[upload_channel] & (peer_info::bw_network | peer_info::bw_limit)) return; if (m_channel_state[upload_channel] & (peer_info::bw_network | peer_info::bw_limit)) return;
shared_ptr<torrent> t = m_torrent.lock(); shared_ptr<torrent> t = m_torrent.lock();
@ -4659,9 +4661,9 @@ namespace libtorrent
// upload rate being virtually 0. If m_requests is empty, it doesn't // upload rate being virtually 0. If m_requests is empty, it doesn't
// matter anyway, because we don't have any more requests from the // matter anyway, because we don't have any more requests from the
// peer to hang on to the disk // peer to hang on to the disk
if (t->alerts().should_post<performance_alert>()) if (m_ses.m_alerts.should_post<performance_alert>())
{ {
t->alerts().post_alert(performance_alert(t->get_handle() m_ses.m_alerts.post_alert(performance_alert(t->get_handle()
, performance_alert::send_buffer_watermark_too_low)); , performance_alert::send_buffer_watermark_too_low));
} }
} }
@ -4734,6 +4736,7 @@ namespace libtorrent
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
if (m_disconnecting) return;
if (m_channel_state[download_channel] & (peer_info::bw_network | peer_info::bw_limit)) return; if (m_channel_state[download_channel] & (peer_info::bw_network | peer_info::bw_limit)) return;
shared_ptr<torrent> t = m_torrent.lock(); shared_ptr<torrent> t = m_torrent.lock();