Browse Source

report the two local/external addresses we know about (which should be the same)

in 'getinfo' rpc. i believe this should help debugging dht connectivity problems
when we change networks, or router gets a new ip etc.
miguelfreitas
Miguel Freitas 10 years ago
parent
commit
04384df7c4
  1. 3
      libtorrent/include/libtorrent/session_status.hpp
  2. 3
      libtorrent/src/session_impl.cpp
  3. 4
      src/rpcwallet.cpp
  4. 2
      src/twister.cpp

3
libtorrent/include/libtorrent/session_status.hpp

@ -204,6 +204,9 @@ namespace libtorrent @@ -204,6 +204,9 @@ namespace libtorrent
utp_status utp_stats;
int peerlist_size;
// external ip address
std::string external_addr_v4;
};
}

3
libtorrent/src/session_impl.cpp

@ -5718,6 +5718,9 @@ retry: @@ -5718,6 +5718,9 @@ retry:
s.peerlist_size = peerlist_size;
boost::system::error_code ec;
s.external_addr_v4 = external_address().external_address(address_v4()).to_string(ec);
return s;
}

4
src/rpcwallet.cpp

@ -100,6 +100,10 @@ Value getinfo(const Array& params, bool fHelp) @@ -100,6 +100,10 @@ Value getinfo(const Array& params, bool fHelp)
obj.push_back(Pair("errors", GetWarnings("statusbar")));
}
const CNetAddr paddrPeer("8.8.8.8");
CAddress addr( GetLocalAddress(&paddrPeer) );
obj.push_back(Pair("ext_addr_net1", addr.IsValid() ? addr.ToStringIP() : string()) );
Object torrent_stats = getLibtorrentSessionStatus();
obj.insert( obj.end(), torrent_stats.begin(), torrent_stats.end() );

2
src/twister.cpp

@ -3066,6 +3066,8 @@ Object getLibtorrentSessionStatus() @@ -3066,6 +3066,8 @@ Object getLibtorrentSessionStatus()
boost::shared_ptr<session> ses(m_ses);
if( ses ) {
session_status stats = ses->status();
obj.push_back( Pair("ext_addr_net2", stats.external_addr_v4) );
obj.push_back( Pair("dht_torrents", stats.dht_torrents) );
obj.push_back( Pair("num_peers", stats.num_peers) );

Loading…
Cancel
Save