diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index ff4166205..b97be22dc 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -511,6 +511,9 @@ namespace libtorrent // implements dht_observer virtual void set_external_address(address const& ip + , address const& source); + + void set_external_address(address const& ip , int source_type, address const& source); external_ip const& external_address() const; diff --git a/include/libtorrent/kademlia/dht_observer.hpp b/include/libtorrent/kademlia/dht_observer.hpp index 42779ecf9..cb7aa3d69 100644 --- a/include/libtorrent/kademlia/dht_observer.hpp +++ b/include/libtorrent/kademlia/dht_observer.hpp @@ -40,7 +40,7 @@ namespace libtorrent { namespace dht struct dht_observer { virtual void set_external_address(address const& addr - , int source_type, address const& source) = 0; + , address const& source) = 0; }; }} diff --git a/src/kademlia/rpc_manager.cpp b/src/kademlia/rpc_manager.cpp index e4c75b7ca..b61b23936 100644 --- a/src/kademlia/rpc_manager.cpp +++ b/src/kademlia/rpc_manager.cpp @@ -33,10 +33,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/pch.hpp" #include "libtorrent/socket.hpp" -// TODO: 3 remove this dependency by having the dht observer -// have its own flags -#include "libtorrent/aux_/session_impl.hpp" - #include #include @@ -349,7 +345,7 @@ bool rpc_manager::incoming(msg const& m, node_id* id) memcpy(&b[0], ext_ip->string_ptr(), 4); if (m_observer) m_observer->set_external_address(address_v4(b) - , aux::session_impl::source_dht, m.addr.address()); + , m.addr.address()); } #if TORRENT_USE_IPV6 else if (ext_ip && ext_ip->string_length() == 16) @@ -359,7 +355,7 @@ bool rpc_manager::incoming(msg const& m, node_id* id) memcpy(&b[0], ext_ip->string_ptr(), 16); if (m_observer) m_observer->set_external_address(address_v6(b) - , aux::session_impl::source_dht, m.addr.address()); + , m.addr.address()); } #endif diff --git a/src/session_impl.cpp b/src/session_impl.cpp index c98e1257e..d1f0ff74a 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -6115,6 +6115,13 @@ retry: external_ip const& session_impl::external_address() const { return m_external_ip; } + // this is the DHT observer version. DHT is the implied source + void session_impl::set_external_address(address const& ip + , address const& source) + { + set_external_address(ip, source_dht, source); + } + void session_impl::set_external_address(address const& ip , int source_type, address const& source) { diff --git a/src/utp_stream.cpp b/src/utp_stream.cpp index ef8f18b6e..e34e71f97 100644 --- a/src/utp_stream.cpp +++ b/src/utp_stream.cpp @@ -409,10 +409,10 @@ struct utp_socket_impl // timers when we should trigger the read and // write callbacks (unless the buffers fill up // before) - // TODO: 3 remove the read timeout concept. This should not be necessary + // TODO: 3 remove the read timeout concept. This should not be necessary, use nagle-like semantics instead ptime m_read_timeout; - // TODO: 3 remove the write timeout concept. This should not be necessary + // TODO: 3 remove the write timeout concept. This should not be necessary, use nagle-like semantics instead ptime m_write_timeout; // the time when the last packet we sent times out. Including re-sends.