From 8e604b44a541546dee56b7c0b5e72ef0f7f6f4e2 Mon Sep 17 00:00:00 2001 From: Viacheslav Chimishuk Date: Wed, 3 Aug 2022 06:38:37 +0300 Subject: [PATCH] Fix broken tr_sessionSetPeerPortRandom() function. (#3569) --- libtransmission/session.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libtransmission/session.cc b/libtransmission/session.cc index 0ebe9e62b..6f04a6a9f 100644 --- a/libtransmission/session.cc +++ b/libtransmission/session.cc @@ -1291,10 +1291,10 @@ uint16_t tr_sessionGetPeerPort(tr_session const* session) uint16_t tr_sessionSetPeerPortRandom(tr_session* session) { - TR_ASSERT(tr_isSession(session)); + tr_port p = getRandomPort(session); + tr_sessionSetPeerPort(session, p.host()); - session->setPeerPort(getRandomPort(session)); - return session->private_peer_port.host(); + return p.host(); } void tr_sessionSetPeerPortRandomOnStart(tr_session* session, bool random)