mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-09 06:18:02 +00:00
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.
This commit is contained in:
parent
bbfa75dc0a
commit
04384df7c4
@ -204,6 +204,9 @@ namespace libtorrent
|
||||
utp_status utp_stats;
|
||||
|
||||
int peerlist_size;
|
||||
|
||||
// external ip address
|
||||
std::string external_addr_v4;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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() );
|
||||
|
||||
|
@ -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…
Reference in New Issue
Block a user