libtorrent (0.12.6-2) 561232.patch

Summary

 libtorrent-0.12.6/src/protocol/handshake_manager.cc |    7 ++++++-
 libtorrent-0.12.6/src/torrent/connection_manager.h  |    1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

    
download this patch

Patch contents

--- build-tree/libtorrent-0.12.6/src/protocol/handshake_manager.cc
+++ build-tree/libtorrent-0.12.6/src/protocol/handshake_manager.cc
@@ -134,8 +134,12 @@
 
 void
 HandshakeManager::create_outgoing(const rak::socket_address& sa, DownloadMain* download, int encryptionOptions) {
+  int peerlist_options = PeerList::connect_keep_handshakes;
+  if (!(encryptionOptions & ConnectionManager::encryption_dont_filter_recent)) {
+    peerlist_options |= PeerList::connect_filter_recent;
+  }
   PeerInfo* peerInfo = download->peer_list()->connected(sa.c_sockaddr(),
-                                                        PeerList::connect_keep_handshakes | PeerList::connect_filter_recent);
+                                                        peerlist_options);
 
   if (peerInfo == NULL || peerInfo->failed_counter() > max_failed)
     return;
@@ -266,6 +270,7 @@
                                                                e_none,
                                                                &download->info()->hash());
 
+    retry_options |= ConnectionManager::encryption_dont_filter_recent;
     create_outgoing(*sa, download, retry_options);
   }
 
--- build-tree/libtorrent-0.12.6/src/torrent/connection_manager.h
+++ build-tree/libtorrent-0.12.6/src/torrent/connection_manager.h
@@ -86,6 +86,7 @@
 
   // Internal to libtorrent.
   static const uint32_t encryption_use_proxy        = (1 << 6);
+  static const uint32_t encryption_dont_filter_recent = (1 << 7);
 
   enum {
     handshake_incoming           = 1,