Add bt_peer_connection::write_dht_port() (#1360)

add void bt_peer_connection::write_dht_port()
This commit is contained in:
Pavel Pimenov 2016-11-29 16:11:13 +03:00 committed by Arvid Norberg
parent ee61d5c308
commit e3c5a639ca
2 changed files with 8 additions and 14 deletions

View File

@ -272,6 +272,7 @@ namespace libtorrent
#endif
private:
void write_dht_port();
bool dispatch_message(int received);
// returns the block currently being

View File

@ -326,6 +326,11 @@ namespace libtorrent
TORRENT_ASSERT(t);
write_bitfield();
TORRENT_ASSERT(m_sent_bitfield);
write_dht_port();
}
void bt_peer_connection::write_dht_port()
{
#ifndef TORRENT_DISABLE_DHT
if (m_supports_dht_port && m_ses.has_dht())
{
@ -1341,13 +1346,7 @@ namespace libtorrent
if (!m_supports_dht_port)
{
m_supports_dht_port = true;
#ifndef TORRENT_DISABLE_DHT
if (m_supports_dht_port && m_ses.has_dht())
{
int const port = m_ses.external_udp_port();
if (port >= 0) write_dht_port(port);
}
#endif
write_dht_port();
}
}
@ -3437,13 +3436,7 @@ namespace libtorrent
if (t->ready_for_connections())
{
write_bitfield();
#ifndef TORRENT_DISABLE_DHT
if (m_supports_dht_port && m_ses.has_dht())
{
int const port = m_ses.external_udp_port();
if (port >= 0) write_dht_port(port);
}
#endif
write_dht_port();
// if we don't have any pieces, don't do any preemptive
// unchoking at all.