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

Method CNode

src/p2p/node.h:209–260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207 bool fPingQueued;
208
209 CNode(SOCKET hSocketIn, CAddress addrIn, string addrNameIn = "", bool fInboundIn = false)
210 : ssSend(SER_NETWORK, INIT_PROTO_VERSION), setAddrKnown(5000) {
211 nServices = 0;
212 hSocket = hSocketIn;
213 nRecvVersion = INIT_PROTO_VERSION;
214 nLastSend = 0;
215 nLastRecv = 0;
216 nSendBytes = 0;
217 nRecvBytes = 0;
218 nLastSendEmpty = GetTime();
219 nTimeConnected = GetTime();
220 addr = addrIn;
221 addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn;
222 nVersion = 0;
223 strSubVer = "";
224 fOneShot = false;
225 fClient = false; // set by version message
226 fInbound = fInboundIn;
227 fNetworkNode = false;
228 fSuccessfullyConnected = false;
229 fDisconnect = false;
230 nRefCount = 0;
231 nSendSize = 0;
232 nSendOffset = 0;
233 hashContinue = uint256();
234 pIndexLastGetBlocksBegin = 0;
235 hashLastGetBlocksEnd = uint256();
236 nStartingHeight = -1;
237 fStartSync = false;
238 fGetAddr = false;
239 fRelayTxes = false;
240 setInventoryKnown.max_size(SendBufferSize() / 1000);
241 auto maxPbftMsgSize = MaxPbftMsgSize();
242 setBlockConfirmMsgKnown.max_size(maxPbftMsgSize);
243 setBlockFinalityMsgKnown.max_size(maxPbftMsgSize);
244 pFilter = new CBloomFilter();
245 nPingNonceSent = 0;
246 nPingUsecStart = 0;
247 nPingUsecTime = 0;
248 fPingQueued = false;
249
250 {
251 LOCK(cs_nLastNodeId);
252 id = nLastNodeId++;
253 }
254
255 // Be shy and don't send version until we hear
256 if (hSocket != INVALID_SOCKET && !fInbound)
257 PushVersion();
258
259 GetNodeSignals().InitializeNode(GetId(), this);
260 }
261
262 ~CNode() {
263 if (hSocket != INVALID_SOCKET) {

Callers

nothing calls this directly

Calls 6

GetTimeFunction · 0.85
SendBufferSizeFunction · 0.85
MaxPbftMsgSizeFunction · 0.85
ToStringIPPortMethod · 0.80
uint256Class · 0.50
max_sizeMethod · 0.45

Tested by

no test coverage detected