lt sync 2598

This commit is contained in:
Andrew Resch 2008-08-12 08:44:12 +00:00
parent a997758eb2
commit 939c9f34a9
5 changed files with 34 additions and 10 deletions

View File

@ -617,6 +617,7 @@ namespace libtorrent
size -= to_copy;
block_offset = 0;
buffer_offset += to_copy;
++block;
}
ret = j.buffer_size;
++m_cache_stats.blocks_read;

View File

@ -167,6 +167,7 @@ namespace
, {"HL", "Halite"}
, {"HN", "Hydranode"}
, {"KT", "KTorrent"}
, {"LC", "LeechCraft"}
, {"LK", "Linkage"}
, {"LP", "lphant"}
, {"LT", "libtorrent"}

View File

@ -177,15 +177,15 @@ void natpmp::try_next_mapping(int i)
#if defined(TORRENT_LOGGING) || defined(TORRENT_VERBOSE_LOGGING)
ptime now = time_now();
for (std::vector<mapping_t>::iterator i = m_mappings.begin()
, end(m_mappings.end()); i != end; ++i)
for (std::vector<mapping_t>::iterator m = m_mappings.begin()
, end(m_mappings.end()); m != end; ++m)
{
m_log << " " << (i - m_mappings.begin()) << " [ "
"proto: " << (i->protocol == none ? "none" : i->protocol == tcp ? "tcp" : "udp")
<< " port: " << i->external_port
<< " local-port: " << i->local_port
<< " action: " << (i->action == mapping_t::action_none ? "none" : i->action == mapping_t::action_add ? "add" : "delete")
<< " ttl: " << total_seconds(i->expires - now)
m_log << " " << (m - m_mappings.begin()) << " [ "
"proto: " << (m->protocol == none ? "none" : m->protocol == tcp ? "tcp" : "udp")
<< " port: " << m->external_port
<< " local-port: " << m->local_port
<< " action: " << (m->action == mapping_t::action_none ? "none" : m->action == mapping_t::action_add ? "add" : "delete")
<< " ttl: " << total_seconds(m->expires - now)
<< " ]" << std::endl;
}
#endif

View File

@ -1212,14 +1212,16 @@ namespace libtorrent
// if this is a web seed. we don't have a peer_info struct
if (m_peer_info) m_peer_info->seed = true;
m_upload_only = true;
disconnect_if_redundant();
if (is_disconnecting()) return;
m_have_piece.set_all();
m_num_pieces = num_pieces;
t->peer_has_all();
if (!t->is_finished())
t->get_policy().peer_is_interesting(*this);
disconnect_if_redundant();
if (is_disconnecting()) return;
return;
}
@ -1841,6 +1843,10 @@ namespace libtorrent
// (since it doesn't exist yet)
if (!t->ready_for_connections())
{
// assume seeds are interesting when we
// don't even have the metadata
t->get_policy().peer_is_interesting(*this);
disconnect_if_redundant();
// TODO: this might need something more
// so that once we have the metadata

View File

@ -848,6 +848,8 @@ namespace libtorrent
restart_tracker_timer(time_now() + seconds(tracker_retry_delay_max));
if (m_abort) e = tracker_request::stopped;
if (e == tracker_request::none)
{
if (!m_start_sent) e = tracker_request::started;
@ -3393,6 +3395,20 @@ namespace libtorrent
{
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
if (!m_ses.m_queued_for_checking.empty())
{
// if there are torrents waiting to be checked
// assert that there's a torrent that is being
// processed right now
int found = 0;
for (aux::session_impl::torrent_map::iterator i = m_ses.m_torrents.begin()
, end(m_ses.m_torrents.end()); i != end; ++i)
if (i->second->m_state == torrent_status::checking_files) ++found;
// the case of 2 is in the special case where one switches over from
// checking to complete
TORRENT_ASSERT(found == 1 || found == 2);
}
TORRENT_ASSERT(m_resume_entry.type() == lazy_entry::dict_t
|| m_resume_entry.type() == lazy_entry::none_t);