diff --git a/ChangeLog b/ChangeLog index 1cf8a5710..5788154a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -114,6 +114,7 @@ 0.16.18 release + * enable TCP keepalive for socks5 connection for UDP associate * fix python3 support * fix bug in lt_donthave extension * expose i2p_alert to python. cleaning up of i2p connection code diff --git a/src/udp_socket.cpp b/src/udp_socket.cpp index 13edf798a..270c73712 100644 --- a/src/udp_socket.cpp +++ b/src/udp_socket.cpp @@ -943,6 +943,10 @@ void udp_socket::on_allow_connect(int ticket) error_code ec; m_socks5_sock.open(m_proxy_addr.address().is_v4()?tcp::v4():tcp::v6(), ec); + + // enable keepalives + m_socks5_sock.set_option(boost::asio::socket_base::keep_alive(true), ec); + ++m_outstanding_ops; #if TORRENT_USE_ASSERTS ++m_outstanding_connect; diff --git a/src/utp_stream.cpp b/src/utp_stream.cpp index 3afb86360..4bf8cd5db 100644 --- a/src/utp_stream.cpp +++ b/src/utp_stream.cpp @@ -1803,7 +1803,7 @@ bool utp_socket_impl::send_pkt(int flags) else sack = 0; - int size_left = p->allocated - p->size; + boost::int32_t size_left = p->allocated - p->size; TORRENT_ASSERT(size_left > 0); size_left = (std::min)(size_left, m_write_buffer_size); write_payload(p->buf + p->size, size_left);