MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetLocalAddress

Function GetLocalAddress

src/net.cpp:181–191  ·  view source on GitHub ↗

get best local address for a particular peer as a CAddress Otherwise, return the unroutable 0.0.0.0 but filled in with the normal parameters, since the IP may be changed to a useful one by discovery.

Source from the content-addressed store, hash-verified

179// the normal parameters, since the IP may be changed to a useful
180// one by discovery.
181CAddress GetLocalAddress(const CNetAddr* paddrPeer)
182{
183 CAddress ret(CService("0.0.0.0", GetListenPort()), NODE_NONE);
184 CService addr;
185 if (GetLocal(addr, paddrPeer)) {
186 ret = CAddress(addr, NODE_NONE);
187 }
188 ret.nServices = nLocalServices;
189 ret.nTime = GetAdjustedTime();
190 return ret;
191}
192
193bool RecvLine(SOCKET hSocket, string& strLine)
194{

Callers 3

ProcessMessageFunction · 0.85
AdvertizeLocalFunction · 0.85
PushVersionMethod · 0.85

Calls 5

GetListenPortFunction · 0.85
GetLocalFunction · 0.85
GetAdjustedTimeFunction · 0.85
CServiceClass · 0.70
CAddressClass · 0.70

Tested by

no test coverage detected