diff --git a/libtorrent/src/disk_io_thread.cpp b/libtorrent/src/disk_io_thread.cpp index 012658e59..2ce06e51a 100644 --- a/libtorrent/src/disk_io_thread.cpp +++ b/libtorrent/src/disk_io_thread.cpp @@ -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; diff --git a/libtorrent/src/identify_client.cpp b/libtorrent/src/identify_client.cpp index 73221de66..3ba57093e 100755 --- a/libtorrent/src/identify_client.cpp +++ b/libtorrent/src/identify_client.cpp @@ -167,6 +167,7 @@ namespace , {"HL", "Halite"} , {"HN", "Hydranode"} , {"KT", "KTorrent"} + , {"LC", "LeechCraft"} , {"LK", "Linkage"} , {"LP", "lphant"} , {"LT", "libtorrent"} diff --git a/libtorrent/src/natpmp.cpp b/libtorrent/src/natpmp.cpp index 9fbe3182d..b751b083d 100644 --- a/libtorrent/src/natpmp.cpp +++ b/libtorrent/src/natpmp.cpp @@ -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::iterator i = m_mappings.begin() - , end(m_mappings.end()); i != end; ++i) + for (std::vector::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 diff --git a/libtorrent/src/peer_connection.cpp b/libtorrent/src/peer_connection.cpp index 481361b6a..90cedf5b7 100755 --- a/libtorrent/src/peer_connection.cpp +++ b/libtorrent/src/peer_connection.cpp @@ -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 diff --git a/libtorrent/src/torrent.cpp b/libtorrent/src/torrent.cpp index a7eb485e3..4f7b7ee1d 100755 --- a/libtorrent/src/torrent.cpp +++ b/libtorrent/src/torrent.cpp @@ -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);