aboutsummaryrefslogtreecommitdiff
path: root/src/net.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-05-30 11:59:42 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-06-05 13:35:30 +0200
commita7e3c2814c8e49197889a4679461be42254e5c51 (patch)
tree40b9e7b5c3f088f52c2041282f5239bd90e73f81 /src/net.h
parent400fdd08cc95f1e85afafd07ddd9c0bed11483ea (diff)
downloadbitcoin-a7e3c2814c8e49197889a4679461be42254e5c51.tar.xz
rpc: Add listen address to incoming connections in `getpeerinfo`
This adds the listening address on which incoming connections were received to the CNode and CNodeStats structures. The address is reported in `getpeerinfo`. This can be useful for distinguishing connections received on different listening ports (e.g. when using a different listening port for Tor hidden service connections) or different networks.
Diffstat (limited to 'src/net.h')
-rw-r--r--src/net.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/net.h b/src/net.h
index 00d04e9914..b89c13a90d 100644
--- a/src/net.h
+++ b/src/net.h
@@ -504,8 +504,12 @@ public:
double dPingTime;
double dPingWait;
double dMinPing;
+ // Our address, as reported by the peer
std::string addrLocal;
+ // Address of this peer
CAddress addr;
+ // Bind address of our side of the connection
+ CAddress addrBind;
};
@@ -586,7 +590,10 @@ public:
std::atomic<int64_t> nLastRecv;
const int64_t nTimeConnected;
std::atomic<int64_t> nTimeOffset;
+ // Address of this peer
const CAddress addr;
+ // Bind address of our side of the connection
+ const CAddress addrBind;
std::atomic<int> nVersion;
// strSubVer is whatever byte array we read from the wire. However, this field is intended
// to be printed out, displayed to humans in various forms and so on. So we sanitize it and
@@ -676,7 +683,7 @@ public:
CAmount lastSentFeeFilter;
int64_t nextSendTimeFeeFilter;
- CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const std::string &addrNameIn = "", bool fInboundIn = false);
+ CNode(NodeId id, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress &addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const CAddress &addrBindIn, const std::string &addrNameIn = "", bool fInboundIn = false);
~CNode();
private:
@@ -695,6 +702,7 @@ private:
mutable CCriticalSection cs_addrName;
std::string addrName;
+ // Our address, as reported by the peer
CService addrLocal;
mutable CCriticalSection cs_addrLocal;
public: