lt sync 2637

This commit is contained in:
Andrew Resch 2008-08-26 01:03:39 +00:00
parent dc5e3d9bfa
commit de5dd796d0
6 changed files with 26 additions and 12 deletions

View File

@ -1009,9 +1009,8 @@ namespace libtorrent
virtual std::string message() const
{
error_code ec;
return "listening on " + endpoint.address().to_string(ec) + ":"
+ boost::lexical_cast<std::string>(endpoint.port()) + " failed: "
+ error.message();
return "listening on " + boost::lexical_cast<std::string>(endpoint)
+ " failed: " + error.message();
}
};
@ -1031,8 +1030,7 @@ namespace libtorrent
virtual std::string message() const
{
error_code ec;
return "successfully listening on " + endpoint.address().to_string(ec)
+ ":" + boost::lexical_cast<std::string>(endpoint.port());
return "successfully listening on " + boost::lexical_cast<std::string>(endpoint);
}
};

View File

@ -161,6 +161,7 @@ namespace libtorrent
void we_have(int index);
void we_dont_have(int index);
// sets all pieces to dont-have
void init(int blocks_per_piece, int total_num_blocks);
int num_pieces() const { return int(m_piece_map.size()); }

View File

@ -1588,8 +1588,8 @@ namespace libtorrent
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_ERROR_LOGGING
(*m_logger) << time_now_string()
<< " *** SKIPPED_PIECE [ piece: " << eq.block.piece_index << " | "
"b: " << eq.block.block_index << " ] ***\n";
<< " *** SKIPPED_PIECE [ piece: " << qe.block.piece_index << " | "
"b: " << qe.block.block_index << " ] ***\n";
#endif
++qe.skipped;

View File

@ -82,6 +82,18 @@ namespace libtorrent
m_piece_map.resize((total_num_blocks + blocks_per_piece-1) / blocks_per_piece
, piece_pos(0, 0));
m_num_filtered += m_num_have_filtered;
m_num_have_filtered = 0;
m_num_have = 0;
m_dirty = true;
for (std::vector<piece_pos>::iterator i = m_piece_map.begin()
, end(m_piece_map.end()); i != end; ++i)
{
i->peer_count = 0;
i->downloading = 0;
i->index = 0;
}
// the piece index is stored in 20 bits, which limits the allowed
// number of pieces somewhat
if (m_piece_map.size() >= piece_pos::we_have_index)
@ -1074,7 +1086,7 @@ namespace libtorrent
if (new_piece_priority == int(p.piece_priority)) return false;
int prev_priority = p.priority(this);
TORRENT_ASSERT(prev_priority < int(m_priority_boundries.size()));
TORRENT_ASSERT(m_dirty | prev_priority < int(m_priority_boundries.size()));
bool ret = false;
if (new_piece_priority == piece_pos::filter_priority
@ -1101,8 +1113,6 @@ namespace libtorrent
if (prev_priority == new_priority) return ret;
TORRENT_ASSERT(prev_priority < int(m_priority_boundries.size()));
if (m_dirty) return ret;
if (prev_priority == -1)
{

View File

@ -601,7 +601,7 @@ namespace aux {
return listen_socket_t();
}
s.external_port = s.sock->local_endpoint(ec).port();
s.sock->listen(0, ec);
s.sock->listen(5, ec);
if (ec)
{
if (m_alerts.should_post<listen_failed_alert>())
@ -724,6 +724,10 @@ namespace aux {
}
}
}
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
m_logger = create_log("main_session", listen_port(), false);
#endif
}
#ifndef TORRENT_DISABLE_DHT
@ -2372,6 +2376,8 @@ namespace aux {
{
TORRENT_ASSERT(ip != address());
if (is_local(ip)) return;
if (is_loopback(ip)) return;
if (m_external_address == ip) return;
m_external_address = ip;

View File

@ -667,7 +667,6 @@ namespace libtorrent
, m_save_path, m_ses.m_files, m_ses.m_disk_thread, m_storage_constructor
, m_storage_mode);
m_storage = m_owning_storage.get();
m_picker.reset(new piece_picker);
m_picker->init(m_torrent_file->piece_length() / m_block_size
, int((m_torrent_file->total_size()+m_block_size-1)/m_block_size));
// assume that we don't have anything