diff --git a/examples/client_test.cpp b/examples/client_test.cpp index a2c5ec805..9c874831f 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -921,8 +921,9 @@ bool handle_alert(libtorrent::session& ses, libtorrent::alert* a *port++ = 0; char const* ip = peer.c_str(); int peer_port = atoi(port); + error_code ec; if (peer_port > 0) - h.connect_peer(tcp::endpoint(address::from_string(ip), peer_port)); + h.connect_peer(tcp::endpoint(address::from_string(ip, ec), peer_port)); } } @@ -1044,7 +1045,7 @@ void print_piece(libtorrent::partial_piece_info* pp { if (pp->blocks[j].num_peers > 1) color = esc("1;7"); else color = esc("33;7"); - chr = '0' + (pp->blocks[j].bytes_progress / float(pp->blocks[j].block_size) * 10); + chr = '0' + (pp->blocks[j].bytes_progress * 10 / pp->blocks[j].block_size); } else if (pp->blocks[j].state == block_info::finished) color = esc("32;7"); else if (pp->blocks[j].state == block_info::writing) color = esc("36;7"); diff --git a/src/session_impl.cpp b/src/session_impl.cpp index eeaa825ce..b8e376679 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -2085,7 +2085,7 @@ namespace aux { // if we asked the system to listen on port 0, which // socket did it end up choosing? if (ep.port() == 0) - ep.port(s->sock->local_endpoint().port()); + ep.port(s->sock->local_endpoint(ec).port()); if (m_alerts.should_post()) m_alerts.post_alert(listen_succeeded_alert(ep));