*** empty log message ***

This commit is contained in:
Arvid Norberg 2005-08-18 23:55:32 +00:00
parent 356df1bd32
commit e930580f13
2 changed files with 28 additions and 8 deletions

View File

@ -77,7 +77,13 @@ namespace libtorrent
, selector& sel , selector& sel
, torrent* t , torrent* t
, boost::shared_ptr<libtorrent::socket> s) , boost::shared_ptr<libtorrent::socket> s)
: m_state(read_protocol_length) :
#ifndef NDEBUG
m_last_choke(boost::posix_time::second_clock::universal_time()
- hours(1))
,
#endif
m_state(read_protocol_length)
, m_timeout(120) , m_timeout(120)
, m_packet_size(1) , m_packet_size(1)
, m_recv_pos(0) , m_recv_pos(0)
@ -159,7 +165,13 @@ namespace libtorrent
detail::session_impl& ses detail::session_impl& ses
, selector& sel , selector& sel
, boost::shared_ptr<libtorrent::socket> s) , boost::shared_ptr<libtorrent::socket> s)
: m_state(read_protocol_length) :
#ifndef NDEBUG
m_last_choke(boost::posix_time::second_clock::universal_time()
- hours(1))
,
#endif
m_state(read_protocol_length)
, m_timeout(120) , m_timeout(120)
, m_packet_size(1) , m_packet_size(1)
, m_recv_pos(0) , m_recv_pos(0)
@ -522,8 +534,7 @@ namespace libtorrent
// remove all pieces from this peers download queue and // remove all pieces from this peers download queue and
// remove the 'downloading' flag from piece_picker. // remove the 'downloading' flag from piece_picker.
for (std::deque<piece_block>::iterator i = m_download_queue.begin(); for (std::deque<piece_block>::iterator i = m_download_queue.begin();
i != m_download_queue.end(); i != m_download_queue.end(); ++i)
++i)
{ {
m_torrent->picker().abort_download(*i); m_torrent->picker().abort_download(*i);
} }
@ -1680,6 +1691,10 @@ namespace libtorrent
using namespace boost::posix_time; using namespace boost::posix_time;
(*m_logger) << to_simple_string(second_clock::universal_time()) (*m_logger) << to_simple_string(second_clock::universal_time())
<< " ==> CHOKE\n"; << " ==> CHOKE\n";
#endif
#ifndef NDEBUG
using namespace boost::posix_time;
m_last_choke = second_clock::universal_time();
#endif #endif
m_num_invalid_requests = 0; m_num_invalid_requests = 0;
m_requests.clear(); m_requests.clear();
@ -1690,6 +1705,15 @@ namespace libtorrent
{ {
INVARIANT_CHECK; INVARIANT_CHECK;
#ifndef NDEBUG
// TODO: once the policy lowers the interval for optimistic
// unchoke, increase this value that interval
// this condition cannot be guaranteed since if peers disconnect
// a new one will be unchoked ignoring when it was last choked
using namespace boost::posix_time;
//assert(second_clock::universal_time() - m_last_choke > seconds(9));
#endif
if (!m_choked) return; if (!m_choked) return;
char msg[] = {0,0,0,1,msg_unchoke}; char msg[] = {0,0,0,1,msg_unchoke};
m_send_buffer.insert(m_send_buffer.end(), msg, msg+sizeof(msg)); m_send_buffer.insert(m_send_buffer.end(), msg, msg+sizeof(msg));

View File

@ -426,10 +426,6 @@ namespace libtorrent
&& m_torrent->ratio() != 0) continue; && m_torrent->ratio() != 0) continue;
if (c->statistics().download_rate() < max_down_speed) continue; if (c->statistics().download_rate() < max_down_speed) continue;
// if (i->last_optimistically_unchoked > min_time) continue; // if (i->last_optimistically_unchoked > min_time) continue;
#ifndef NDEBUG
using namespace boost::posix_time;
assert(second_clock::universal_time() - c->m_last_choke > seconds(9));
#endif
min_time = i->last_optimistically_unchoked; min_time = i->last_optimistically_unchoked;
max_down_speed = c->statistics().download_rate(); max_down_speed = c->statistics().download_rate();