From 08e15e2f0cdb80f3bb96ccdf7463e0dcad17e217 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 2 Jan 2007 17:44:15 +0000 Subject: [PATCH] updated Makefile for latest asio, fix in peer exchange, updated client_test output --- examples/client_test.cpp | 10 +++++++--- include/Makefile.am | 3 +++ src/identify_client.cpp | 2 +- src/ut_pex.cpp | 6 ++++++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/examples/client_test.cpp b/examples/client_test.cpp index eb549ff3d..1c2629f60 100755 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -870,10 +870,14 @@ int main(int ac, char* av[]) out << "peers: " << s.num_peers << " " << "seeds: " << s.num_seeds << " " << "distributed copies: " << s.distributed_copies << "\n"; + out << "download: " << esc("32") << add_suffix(s.download_rate) << "/s " << esc("0") + << "(" << esc("32") << add_suffix(s.total_download) << esc("0") << ") "; } - out << "download: " << esc("32") << add_suffix(s.download_rate) << "/s " << esc("0") - << "(" << esc("32") << add_suffix(s.total_download) << esc("0") << ") " - << "upload: " << esc("31") << add_suffix(s.upload_rate) << "/s " << esc("0") + else + { + out << "download: " << "(" << esc("32") << add_suffix(s.total_download) << esc("0") << ") "; + } + out << "upload: " << esc("31") << add_suffix(s.upload_rate) << "/s " << esc("0") << "(" << esc("31") << add_suffix(s.total_upload) << esc("0") << ") " << "ratio: " << ratio(s.total_payload_download, s.total_payload_upload) << "\n"; if (s.state != torrent_status::seeding) diff --git a/include/Makefile.am b/include/Makefile.am index fb18353f0..70d98fb00 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -126,6 +126,9 @@ libtorrent/asio/detail/select_interrupter.hpp \ libtorrent/asio/detail/select_reactor.hpp \ libtorrent/asio/detail/select_reactor_fwd.hpp \ libtorrent/asio/detail/service_registry.hpp \ +libtorrent/asio/detail/service_registry_fwd.hpp \ +libtorrent/asio/detail/service_base.hpp \ +libtorrent/asio/detail/service_id.hpp \ libtorrent/asio/detail/signal_blocker.hpp \ libtorrent/asio/detail/signal_init.hpp \ libtorrent/asio/detail/socket_holder.hpp \ diff --git a/src/identify_client.cpp b/src/identify_client.cpp index 014ca39dd..aff125454 100755 --- a/src/identify_client.cpp +++ b/src/identify_client.cpp @@ -158,7 +158,7 @@ namespace , map_entry("LP", "lphant") , map_entry("LT", "libtorrent") , map_entry("M", "Mainline") - , map_entry("ML", "MLDonkey") + , map_entry("ML", "MLDonkey") , map_entry("MP", "MooPolice") , map_entry("MT", "Moonlight Torrent") , map_entry("O", "Osprey Permaseed") diff --git a/src/ut_pex.cpp b/src/ut_pex.cpp index adeadd820..d0a0e5514 100644 --- a/src/ut_pex.cpp +++ b/src/ut_pex.cpp @@ -83,7 +83,11 @@ namespace libtorrent { namespace for (torrent::peer_iterator i = m_torrent.begin() , end(m_torrent.end()); i != end; ++i) { + // don't send out peers that we haven't connected to + // (that have connected to us) if (!i->second->is_local()) continue; + // don't send out peers that we haven't successfully connected to + if (i->second->connecting()) continue; cs.push_back(i->first); } std::list added_peers, dropped_peers; @@ -101,6 +105,7 @@ namespace libtorrent { namespace std::back_insert_iterator pld_out(pld); std::back_insert_iterator plf_out(plf); + // TODO: use random selection in case added_peers.size() > num_peers for (std::list::const_iterator i = added_peers.begin() , end(added_peers.end());i != end; ++i) { @@ -114,6 +119,7 @@ namespace libtorrent { namespace } num_peers = max_peer_entries; + // TODO: use random selection in case dropped_peers.size() > num_peers for (std::list::const_iterator i = dropped_peers.begin() , end(dropped_peers.end());i != end; ++i) {