From 5bda955f8f8253cedb7a924ced754852b7bce070 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Wed, 20 Jul 2016 10:11:28 -0700 Subject: [PATCH] don't send bitfield to peers whose handshake we haven't fully received yet (#925) --- src/bt_peer_connection.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index 7d37f4704..cd55acb8d 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -270,6 +270,11 @@ namespace libtorrent disconnect_if_redundant(); if (m_disconnecting) return; + if (!m_sent_handshake) return; + // we haven't gotten far enough on the incoming handshake to be able to + // send the bitfield yet + if (m_state < read_packet_size) return; + // connections that are still in the handshake // will send their bitfield when the handshake // is done @@ -277,7 +282,6 @@ namespace libtorrent write_upload_only(); #endif - if (!m_sent_handshake) return; if (m_sent_bitfield) return; boost::shared_ptr t = associated_torrent().lock(); TORRENT_ASSERT(t);