1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-30 19:46:56 +00:00

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

View file

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