forked from premiere/premiere-libtorrent
merged udp socket fix from RC_0_16
This commit is contained in:
parent
3bf462f858
commit
9ed60479ce
|
@ -5,6 +5,7 @@
|
|||
* fix uTP edge case where udp socket buffer fills up
|
||||
* fix nagle implementation in uTP
|
||||
|
||||
* try harder to bind the udp socket (uTP, DHT, UDP-trackers, LSD) to the same port as TCP
|
||||
* relax file timestamp requirements for accepting resume data
|
||||
* fix performance issue in web seed downloader (coalescing of blocks sometimes wouldn't work)
|
||||
* web seed fixes (better support for torrents without trailing / in web seeds)
|
||||
|
|
|
@ -769,7 +769,7 @@ namespace libtorrent
|
|||
boost::shared_ptr<socket_type> m_i2p_listen_socket;
|
||||
#endif
|
||||
|
||||
void setup_listener(listen_socket_t* s, tcp::endpoint ep, int retries
|
||||
void setup_listener(listen_socket_t* s, tcp::endpoint ep, int& retries
|
||||
, bool v6_only, int flags, error_code& ec);
|
||||
|
||||
// the proxy used for bittorrent
|
||||
|
|
|
@ -2101,7 +2101,7 @@ namespace aux {
|
|||
}
|
||||
|
||||
void session_impl::setup_listener(listen_socket_t* s, tcp::endpoint ep
|
||||
, int retries, bool v6_only, int flags, error_code& ec)
|
||||
, int& retries, bool v6_only, int flags, error_code& ec)
|
||||
{
|
||||
s->sock.reset(new socket_acceptor(m_io_service));
|
||||
s->sock->open(ep.protocol(), ec);
|
||||
|
@ -2201,6 +2201,8 @@ namespace aux {
|
|||
{
|
||||
TORRENT_ASSERT(is_network_thread());
|
||||
|
||||
retry:
|
||||
|
||||
// close the open listen sockets
|
||||
m_listen_sockets.clear();
|
||||
m_incoming_connection = false;
|
||||
|
@ -2330,14 +2332,19 @@ namespace aux {
|
|||
m_udp_socket.bind(udp::endpoint(m_listen_interface.address(), m_listen_interface.port()), ec);
|
||||
if (ec)
|
||||
{
|
||||
if (m_alerts.should_post<listen_failed_alert>())
|
||||
m_alerts.post_alert(listen_failed_alert(m_listen_interface, ec));
|
||||
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||
char msg[200];
|
||||
snprintf(msg, sizeof(msg), "cannot bind to UDP interface \"%s\": %s"
|
||||
, print_endpoint(m_listen_interface).c_str(), ec.message().c_str());
|
||||
(*m_logger) << msg << "\n";
|
||||
#endif
|
||||
if (m_listen_port_retries > 0)
|
||||
{
|
||||
m_listen_interface.port(m_listen_interface.port() + 1);
|
||||
goto retry;
|
||||
}
|
||||
if (m_alerts.should_post<listen_failed_alert>())
|
||||
m_alerts.post_alert(listen_failed_alert(m_listen_interface, ec));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue