*** empty log message ***

This commit is contained in:
Arvid Norberg 2005-04-03 15:44:17 +00:00
parent b82e0d2901
commit 1672eed3f2
3 changed files with 21 additions and 3 deletions

View File

@ -516,6 +516,15 @@ namespace libtorrent
// if we're waiting for a metadata request
// this was the request we sent
std::pair<int, int> m_last_metadata_request;
// this is true until this socket has received
// data for the first time. While connecting
// the timeout will not be triggered. This is
// because windows XP SP2 may delay connection
// attempts, which means that the connection
// may not even have been attempted when the
// time out is reached.
bool m_connecting;
};
}

View File

@ -123,6 +123,7 @@ namespace libtorrent
boost::gregorian::date(1970, boost::date_time::Jan, 1)
, boost::posix_time::seconds(0))
, m_waiting_metadata_request(false)
, m_connecting(false)
{
INVARIANT_CHECK;
@ -201,6 +202,7 @@ namespace libtorrent
boost::gregorian::date(1970, boost::date_time::Jan, 1)
, boost::posix_time::seconds(0))
, m_waiting_metadata_request(false)
, m_connecting(true)
{
INVARIANT_CHECK;
@ -1894,6 +1896,7 @@ namespace libtorrent
if (received > 0)
{
m_connecting = false;
m_last_receive = second_clock::universal_time();
m_recv_pos += received;
@ -2340,12 +2343,17 @@ namespace libtorrent
{
using namespace boost::posix_time;
// if the socket is still connecting, don't
// consider it timed out. Because Windows XP SP2
// may delay connection attempts.
if (m_connecting) return false;
// if the peer hasn't said a thing for a certain
// time, it is considered to have timed out
time_duration d;
d = second_clock::universal_time() - m_last_receive;
if (d > seconds(m_timeout)) return true;
/*
// if the peer hasn't become interested and we haven't
// become interested in the peer for 60 seconds, it
// has also timed out.
@ -2360,6 +2368,7 @@ namespace libtorrent
{
return true;
}
*/
return false;
}

View File

@ -340,7 +340,7 @@ namespace libtorrent
policy::peer* policy::find_choke_candidate()
{
peer* worst_peer = 0;
size_type min_weight = std::numeric_limits<int>::max();
size_type min_weight = std::numeric_limits<int>::min();
// TODO: make this selection better
@ -395,7 +395,7 @@ namespace libtorrent
if (c->is_disconnecting()) continue;
if (!c->is_choked()) continue;
if (!c->is_peer_interested()) continue;
if (c->share_diff() < -free_upload_amount
if (c->share_diff() < -free_upload_amount
&& m_torrent->ratio() != 0) continue;
if (c->statistics().download_rate() < max_down_speed) continue;
// if (i->last_optimistically_unchoked > min_time) continue;