forked from premiere/premiere-libtorrent
ignore failures when asking for local address of sockets and parsing a string into an IP address
This commit is contained in:
parent
065d75b02d
commit
079a8f8314
|
@ -921,8 +921,9 @@ bool handle_alert(libtorrent::session& ses, libtorrent::alert* a
|
||||||
*port++ = 0;
|
*port++ = 0;
|
||||||
char const* ip = peer.c_str();
|
char const* ip = peer.c_str();
|
||||||
int peer_port = atoi(port);
|
int peer_port = atoi(port);
|
||||||
|
error_code ec;
|
||||||
if (peer_port > 0)
|
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");
|
if (pp->blocks[j].num_peers > 1) color = esc("1;7");
|
||||||
else color = esc("33;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::finished) color = esc("32;7");
|
||||||
else if (pp->blocks[j].state == block_info::writing) color = esc("36;7");
|
else if (pp->blocks[j].state == block_info::writing) color = esc("36;7");
|
||||||
|
|
|
@ -2085,7 +2085,7 @@ namespace aux {
|
||||||
// if we asked the system to listen on port 0, which
|
// if we asked the system to listen on port 0, which
|
||||||
// socket did it end up choosing?
|
// socket did it end up choosing?
|
||||||
if (ep.port() == 0)
|
if (ep.port() == 0)
|
||||||
ep.port(s->sock->local_endpoint().port());
|
ep.port(s->sock->local_endpoint(ec).port());
|
||||||
|
|
||||||
if (m_alerts.should_post<listen_succeeded_alert>())
|
if (m_alerts.should_post<listen_succeeded_alert>())
|
||||||
m_alerts.post_alert(listen_succeeded_alert(ep));
|
m_alerts.post_alert(listen_succeeded_alert(ep));
|
||||||
|
|
Loading…
Reference in New Issue