diff --git a/src/ut_pex.cpp b/src/ut_pex.cpp index dcfd74f38..f3dd94b83 100644 --- a/src/ut_pex.cpp +++ b/src/ut_pex.cpp @@ -165,11 +165,10 @@ namespace libtorrent { namespace // if the peer has told us which port its listening on, // use that port. But only if we didn't connect to the peer. // if we connected to it, use the port we know works - torrent_peer *pi = 0; if (!p->is_outgoing()) { - pi = peer->peer_info_struct(); - if ((pi != NULL) && (pi->port > 0)) + torrent_peer const* const pi = peer->peer_info_struct(); + if (pi != NULL && pi->port > 0) remote.port(pi->port); } @@ -581,11 +580,10 @@ namespace libtorrent { namespace tcp::endpoint remote = peer->remote(); - torrent_peer *pi = 0; if (!p->is_outgoing()) { - pi = peer->peer_info_struct(); - if ((pi != NULL) && (pi->port > 0)) + torrent_peer const* const pi = peer->peer_info_struct(); + if (pi != NULL && pi->port > 0) remote.port(pi->port); } diff --git a/src/utp_stream.cpp b/src/utp_stream.cpp index 2a8422194..bf2b1f0df 100644 --- a/src/utp_stream.cpp +++ b/src/utp_stream.cpp @@ -2511,7 +2511,7 @@ bool utp_socket_impl::cancel_handlers(error_code const& ec, bool kill) bool ret = m_read_handler || m_write_handler || m_connect_handler; // calling the callbacks with m_userdata being 0 will just crash - TORRENT_ASSERT((ret && (m_userdata != NULL)) || !ret); + TORRENT_ASSERT((ret && m_userdata != NULL) || !ret); bool read = m_read_handler; bool write = m_write_handler;