From e71f70a98d071e8f93a474b08c2b1dc6a3ad5051 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Thu, 18 Feb 2010 05:27:58 +0000 Subject: [PATCH] no need to disconnect peers that send DHT_PORT message without advertising support for it --- src/bt_peer_connection.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/bt_peer_connection.cpp b/src/bt_peer_connection.cpp index 09e5a14b4..1501b6946 100644 --- a/src/bt_peer_connection.cpp +++ b/src/bt_peer_connection.cpp @@ -1315,11 +1315,6 @@ namespace libtorrent TORRENT_ASSERT(received > 0); m_statistics.received_bytes(0, received); - if (!m_supports_dht_port) - { - disconnect(errors::invalid_dht_port, 2); - return; - } if (packet_size() != 3) { disconnect(errors::invalid_dht_port, 2); @@ -1333,6 +1328,15 @@ namespace libtorrent int listen_port = detail::read_uint16(ptr); incoming_dht_port(listen_port); + + if (!m_supports_dht_port) + { + m_supports_dht_port = true; +#ifndef TORRENT_DISABLE_DHT + if (m_supports_dht_port && m_ses.m_dht) + write_dht_port(m_ses.get_dht_settings().service_port); +#endif + } } void bt_peer_connection::on_suggest_piece(int received)