MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / CNode

Method CNode

src/net.cpp:2098–2161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2096unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
2097
2098CNode::CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn, bool fInboundIn) :
2099 ssSend(SER_NETWORK, INIT_PROTO_VERSION),
2100 addrKnown(5000, 0.001),
2101 filterInventoryKnown(50000, 0.000001)
2102{
2103 nServices = 0;
2104 hSocket = hSocketIn;
2105 nRecvVersion = INIT_PROTO_VERSION;
2106 nLastSend = 0;
2107 nLastRecv = 0;
2108 nSendBytes = 0;
2109 nRecvBytes = 0;
2110 nTimeConnected = GetTime();
2111 nTimeOffset = 0;
2112 addr = addrIn;
2113 addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn;
2114 nVersion = 0;
2115 strSubVer = "";
2116 fWhitelisted = false;
2117 fOneShot = false;
2118 fClient = false; // set by version message
2119 fFeeler = false;
2120 fInbound = fInboundIn;
2121 fNetworkNode = false;
2122 fSuccessfullyConnected = false;
2123 fDisconnect = false;
2124 nRefCount = 0;
2125 nSendSize = 0;
2126 nSendOffset = 0;
2127 hashContinue = uint256();
2128 nStartingHeight = -1;
2129 filterInventoryKnown.reset();
2130 fGetAddr = false;
2131 nNextLocalAddrSend = 0;
2132 nNextAddrSend = 0;
2133 nNextInvSend = 0;
2134 fRelayTxes = false;
2135 fSentAddr = false;
2136 pfilter = new CBloomFilter();
2137 xthinFilter.reset(new CBloomFilter());
2138 nPingNonceSent = 0;
2139 nPingUsecStart = 0;
2140 nPingUsecTime = 0;
2141 fPingQueued = false;
2142
2143 {
2144 LOCK(cs_nLastNodeId);
2145 id = nLastNodeId++;
2146 }
2147
2148 ipgroupSlot = AssignIPGroupSlot(CNetAddr(addr.ToStringIP()));
2149 CIPGroupData ipgroup = ipgroupSlot->Group();
2150 std::string strIpGroup = tfm::format("(group %s)", ipgroup.name);
2151 if (fLogIPs)
2152 LogPrint("net", "Added connection to %s peer=%d %s\n", addrName, id, strIpGroup);
2153 else
2154 LogPrint("net", "Added connection peer=%d %s\n", id, strIpGroup);
2155

Callers

nothing calls this directly

Calls 9

GetTimeFunction · 0.85
AssignIPGroupSlotFunction · 0.85
formatFunction · 0.85
ToStringIPPortMethod · 0.80
resetMethod · 0.80
ToStringIPMethod · 0.80
GroupMethod · 0.80
uint256Class · 0.70
CNetAddrClass · 0.70

Tested by

no test coverage detected