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)