*** empty log message ***

This commit is contained in:
Arvid Norberg 2004-10-17 22:23:08 +00:00
parent c48f64c2ec
commit e9ef2b56a5
7 changed files with 17 additions and 4 deletions

View File

@ -1267,6 +1267,7 @@ struct peer_info
size_type total_upload;
peer_id id;
std::vector<bool> pieces;
bool seed;
int upload_limit;
int upload_ceiling;
@ -1326,6 +1327,7 @@ is using. See identify_client()_</p>
<p><tt class="literal"><span class="pre">pieces</span></tt> is a vector of booleans that has as many entries as there are pieces
in the torrent. Each boolean tells you if the peer has that piece (if it's set to true)
or if the peer miss that piece (set to false).</p>
<p><tt class="literal"><span class="pre">seed</span></tt> is true if this peer is a seed.</p>
<p><tt class="literal"><span class="pre">upload_limit</span></tt> is the number of bytes per second we are allowed to send to this
peer every second. It may be -1 if there's no limit. The upload limits of all peers
should sum up to the upload limit set by <tt class="literal"><span class="pre">session::set_upload_limit</span></tt>.</p>

View File

@ -1238,6 +1238,7 @@ It contains the following fields::
size_type total_upload;
peer_id id;
std::vector<bool> pieces;
bool seed;
int upload_limit;
int upload_ceiling;
@ -1293,6 +1294,8 @@ is using. See identify_client()_
in the torrent. Each boolean tells you if the peer has that piece (if it's set to true)
or if the peer miss that piece (set to false).
``seed`` is true if this peer is a seed.
``upload_limit`` is the number of bytes per second we are allowed to send to this
peer every second. It may be -1 if there's no limit. The upload limits of all peers
should sum up to the upload limit set by ``session::set_upload_limit``.

View File

@ -60,6 +60,7 @@ namespace libtorrent
size_type total_upload;
peer_id id;
std::vector<bool> pieces;
bool seed; // true if this is a seed
int upload_limit; // from peer_connection
int upload_ceiling; // from the global upload limiter

View File

@ -246,6 +246,9 @@ namespace libtorrent
void entry::sort()
{
#if (defined(_MSC_VER) && _MSC_VER < 1300)
assert(false);
#else
using boost::bind;
if (type() == dictionary_t)
{
@ -254,6 +257,7 @@ namespace libtorrent
, bind(&entry::dictionary_type::value_type::first, _1)
, bind(&entry::dictionary_type::value_type::first, _2)));
}
#endif
}
void entry::print(std::ostream& os, int indent) const

View File

@ -2370,7 +2370,9 @@ namespace libtorrent
bool peer_connection::is_seed() const
{
return m_num_pieces == (int)m_have_piece.size();
// if m_num_pieces == 0, we probably doesn't have the
// metadata yet.
return m_num_pieces == (int)m_have_piece.size() && m_num_pieces > 0;
}
void peer_connection::send_buffer_updated()

View File

@ -232,9 +232,9 @@ namespace libtorrent
assert(m_torrent_file.is_valid());
m_have_pieces.resize(m_torrent_file.num_pieces(), false);
m_storage.reset(new piece_manager(m_torrent_file, m_save_path));
m_storage = std::auto_ptr<piece_manager>(new piece_manager(m_torrent_file, m_save_path));
m_block_size = calculate_block_size(m_torrent_file);
m_picker.reset(new piece_picker(
m_picker = std::auto_ptr<piece_picker>(new piece_picker(
static_cast<int>(m_torrent_file.piece_length() / m_block_size)
, static_cast<int>((m_torrent_file.total_size()+m_block_size-1)/m_block_size)));
}
@ -1000,7 +1000,7 @@ namespace libtorrent
int torrent::num_seeds() const
{
return (int)count_if(m_connections.begin(), m_connections.end(),
return (int)std::count_if(m_connections.begin(), m_connections.end(),
boost::bind(&peer_connection::is_seed,
boost::bind(&std::map<address,peer_connection*>::value_type::second, _1)));
}

View File

@ -607,6 +607,7 @@ namespace libtorrent
if (peer->is_local()) p.flags |= peer_info::local_connection;
p.pieces = peer->get_bitfield();
p.seed = peer->is_seed();
}
}