minor cleanup

This commit is contained in:
arvidn 2016-04-18 00:29:50 -04:00
parent 7b5d48c02a
commit ccc227f446
2 changed files with 5 additions and 7 deletions

View File

@ -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);
}

View File

@ -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;