From 34024136aea9139a9b58fecae5cd84f1c40e0926 Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Thu, 10 Oct 2013 23:19:30 -0300 Subject: [PATCH] tweaks. increase m_desired_queue_size, maybe 2 is too low due to rounding number of pieces to the nearest multiple of 8. not sure. --- libtorrent/include/libtorrent/policy.hpp | 2 +- libtorrent/src/bt_peer_connection.cpp | 6 ++++++ libtorrent/src/identify_client.cpp | 1 + libtorrent/src/peer_connection.cpp | 2 +- src/twister.cpp | 3 ++- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libtorrent/include/libtorrent/policy.hpp b/libtorrent/include/libtorrent/policy.hpp index 73190ee4..b3de5998 100644 --- a/libtorrent/include/libtorrent/policy.hpp +++ b/libtorrent/include/libtorrent/policy.hpp @@ -95,7 +95,7 @@ namespace libtorrent enum { // the limits of the download queue size - min_request_queue = 2, + min_request_queue = 8, // the amount of free upload allowed before // the peer is choked diff --git a/libtorrent/src/bt_peer_connection.cpp b/libtorrent/src/bt_peer_connection.cpp index 41f25717..b0e08e02 100644 --- a/libtorrent/src/bt_peer_connection.cpp +++ b/libtorrent/src/bt_peer_connection.cpp @@ -3105,6 +3105,9 @@ namespace libtorrent if (i != p.end_peer()) { TORRENT_ASSERT((*i)->connection->pid() == pid); +#ifdef TORRENT_VERBOSE_LOGGING + peer_log("*** will disconnect: duplicated connection\n"); +#endif // we found another connection with the same peer-id // which connection should be closed in order to be // sure that the other end closes the same connection? @@ -3128,6 +3131,9 @@ namespace libtorrent // since it most likely is ourself then if (pid == m_ses.get_peer_id()) { +#ifdef TORRENT_VERBOSE_LOGGING + peer_log("*** will disconnect: duplicated connection\n"); +#endif if (peer_info_struct()) t->get_policy().ban_peer(peer_info_struct()); disconnect(errors::self_connection, 1); return; diff --git a/libtorrent/src/identify_client.cpp b/libtorrent/src/identify_client.cpp index 07b25459..75532cec 100644 --- a/libtorrent/src/identify_client.cpp +++ b/libtorrent/src/identify_client.cpp @@ -216,6 +216,7 @@ namespace , {"TR", "Transmission"} , {"TS", "TorrentStorm"} , {"TT", "TuoTu"} + , {"TW", "twister"} , {"U", "UPnP"} , {"UL", "uLeecher"} , {"UM", "uTorrent Mac"} diff --git a/libtorrent/src/peer_connection.cpp b/libtorrent/src/peer_connection.cpp index 1b01d6d8..4811b0d1 100644 --- a/libtorrent/src/peer_connection.cpp +++ b/libtorrent/src/peer_connection.cpp @@ -165,7 +165,7 @@ namespace libtorrent , m_upload_rate_peak(0) , m_rtt(0) , m_prefer_whole_pieces(0) - , m_desired_queue_size(2) + , m_desired_queue_size(8) , m_fast_reconnect(false) , m_outgoing(outgoing) , m_received_listen_port(false) diff --git a/src/twister.cpp b/src/twister.cpp index d4b7df92..ad4624d2 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -155,9 +155,10 @@ void ThreadWaitExtIP() session_settings settings; // settings to test local connections settings.allow_multiple_connections_per_ip = true; - settings.enable_outgoing_utp = false; // test (netstat display) + //settings.enable_outgoing_utp = false; // (false to see connections in netstat) //settings.dht_announce_interval = 60; // test //settings.min_announce_interval = 60; // test + settings.anonymous_mode = false; // (false => send peer_id, avoid connecting to itself) ses->set_settings(settings);