*** empty log message ***

This commit is contained in:
Arvid Norberg 2005-08-05 02:43:44 +00:00
parent 4e3ea21809
commit c1ec7e8830
3 changed files with 37 additions and 10 deletions

View File

@ -346,8 +346,8 @@ int main(int argc, char* argv[])
handles.push_back(ses.add_torrent(argv[i+1], info_hash, save_path));
handles.back().set_max_connections(60);
handles.back().set_max_uploads(7);
handles.back().set_ratio(1.1f);
handles.back().set_max_uploads(-1);
// handles.back().set_ratio(1.1f);
++i;
continue;
@ -373,9 +373,9 @@ int main(int argc, char* argv[])
catch (boost::filesystem::filesystem_error&) {}
handles.push_back(ses.add_torrent(e, save_path, resume_data, true, 64 * 1024));
handles.back().set_max_connections(100);
handles.back().set_max_connections(60);
handles.back().set_max_uploads(-1);
handles.back().set_ratio(1.02f);
// handles.back().set_ratio(1.02f);
}
catch (std::exception& e)

View File

@ -128,9 +128,12 @@ namespace libtorrent
{
INVARIANT_CHECK;
// these numbers are used the first second of connection.
// then the given upload limits will be applied by running
// allocate_resources().
m_ul_bandwidth_quota.min = 10;
m_ul_bandwidth_quota.max = 400;
m_ul_bandwidth_quota.given = 400;
m_ul_bandwidth_quota.max = std::numeric_limits<int>::max();
m_ul_bandwidth_quota.given = std::numeric_limits<int>::max();
m_dl_bandwidth_quota.min = 10;
m_dl_bandwidth_quota.max = std::numeric_limits<int>::max();
m_dl_bandwidth_quota.given = 400;
@ -211,10 +214,13 @@ namespace libtorrent
// upload bandwidth will only be given to connections
// that are part of a torrent. Since this is an incoming
// connection, we have to give it some initial bandwidth
// to send the handshake
// to send the handshake.
// after one second, allocate_resources() will be called
// and the correct bandwidth limits will be set on all
// connections.
m_ul_bandwidth_quota.min = 10;
m_ul_bandwidth_quota.max = 400;
m_ul_bandwidth_quota.given = 400;
m_ul_bandwidth_quota.max = std::numeric_limits<int>::max();
m_ul_bandwidth_quota.given = std::numeric_limits<int>::max();
m_dl_bandwidth_quota.min = 10;
m_dl_bandwidth_quota.max = std::numeric_limits<int>::max();

View File

@ -697,6 +697,8 @@ namespace libtorrent
// rotate, unchoke one peer here
// and let the next condiional block
// make sure another peer is choked.
// TODO: This rotation should happen
// far less frequent than this!
seed_unchoke_one_peer();
}
@ -990,8 +992,27 @@ namespace libtorrent
}
// called when a peer is interested in us
void policy::interested(peer_connection&)
void policy::interested(peer_connection& c)
{
// if the peer is choked and we have upload slots left,
// then unchoke it. Another condition that has to be met
// is that the torrent doesn't keep track of the individual
// up/down ratio for each peer (ratio == 0) or (if it does
// keep track) this particular connection isn't a leecher.
// If the peer was choked because it was leeching, don't
// unchoke it again.
// The exception to this last condition is if we're a seed.
// In that case we don't care if people are leeching, they
// can't pay for their downloads anyway.
if (c.is_choked()
&& m_num_unchoked < m_torrent->m_uploads_quota.given
&& (m_torrent->ratio() == 0)
|| (c.share_diff() >= -free_upload_amount
|| m_torrent->is_seed()))
{
c.send_unchoke();
++m_num_unchoked;
}
}
// called when a peer is no longer interested in us