fix potential issue where the dht port message is sent before the peer handshake

This commit is contained in:
arvidn 2018-11-28 10:33:49 +01:00 committed by Arvid Norberg
parent 43f28d68ae
commit a44ddddede
1 changed files with 3 additions and 1 deletions

View File

@ -1373,7 +1373,9 @@ namespace libtorrent
{
m_supports_dht_port = true;
#ifndef TORRENT_DISABLE_DHT
if (m_supports_dht_port && m_ses.has_dht())
// if we're done with the handshake, respond right away, otherwise
// we'll send the DHT port later
if (m_sent_handshake && m_ses.has_dht())
write_dht_port(m_ses.external_udp_port());
#endif
}