fix: broken detection of peer udp port (#4334)

This commit is contained in:
Charles Kerr 2022-12-08 14:44:39 -06:00 committed by GitHub
parent 389919f727
commit f176bb299a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1637,9 +1637,9 @@ static ReadState readBtMessage(tr_peerMsgsImpl* msgs, size_t inlen)
{
logtrace(msgs, "Got a BtPeerMsgs::Port");
auto nport = uint16_t{};
msgs->io->readUint16(&nport);
if (auto const dht_port = tr_port::fromNetwork(nport); !std::empty(dht_port))
auto hport = uint16_t{};
msgs->io->readUint16(&hport); // readUint16 performs ntoh
if (auto const dht_port = tr_port::fromHost(hport); !std::empty(dht_port))
{
msgs->dht_port = dht_port;
msgs->session->addDhtNode(msgs->io->address(), msgs->dht_port);