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 uTP edge case where udp socket buffer fills up
|
||||||
* fix nagle implementation in uTP
|
* 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
|
* relax file timestamp requirements for accepting resume data
|
||||||
* fix performance issue in web seed downloader (coalescing of blocks sometimes wouldn't work)
|
* 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)
|
* 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;
|
boost::shared_ptr<socket_type> m_i2p_listen_socket;
|
||||||
#endif
|
#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);
|
, bool v6_only, int flags, error_code& ec);
|
||||||
|
|
||||||
// the proxy used for bittorrent
|
// the proxy used for bittorrent
|
||||||
|
|
|
@ -2101,7 +2101,7 @@ namespace aux {
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_impl::setup_listener(listen_socket_t* s, tcp::endpoint ep
|
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.reset(new socket_acceptor(m_io_service));
|
||||||
s->sock->open(ep.protocol(), ec);
|
s->sock->open(ep.protocol(), ec);
|
||||||
|
@ -2201,6 +2201,8 @@ namespace aux {
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(is_network_thread());
|
TORRENT_ASSERT(is_network_thread());
|
||||||
|
|
||||||
|
retry:
|
||||||
|
|
||||||
// close the open listen sockets
|
// close the open listen sockets
|
||||||
m_listen_sockets.clear();
|
m_listen_sockets.clear();
|
||||||
m_incoming_connection = false;
|
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);
|
m_udp_socket.bind(udp::endpoint(m_listen_interface.address(), m_listen_interface.port()), ec);
|
||||||
if (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
|
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
|
||||||
char msg[200];
|
char msg[200];
|
||||||
snprintf(msg, sizeof(msg), "cannot bind to UDP interface \"%s\": %s"
|
snprintf(msg, sizeof(msg), "cannot bind to UDP interface \"%s\": %s"
|
||||||
, print_endpoint(m_listen_interface).c_str(), ec.message().c_str());
|
, print_endpoint(m_listen_interface).c_str(), ec.message().c_str());
|
||||||
(*m_logger) << msg << "\n";
|
(*m_logger) << msg << "\n";
|
||||||
#endif
|
#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
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue