| 2388 | unsigned int SendBufferSize() { return 1000 * GetArg("-maxsendbuffer", 1 * 1000); } |
| 2389 | |
| 2390 | CNode::CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn, bool fInboundIn) : ssSend(SER_NETWORK, INIT_PROTO_VERSION), setAddrKnown(5000) |
| 2391 | { |
| 2392 | nServices = NODE_NONE; |
| 2393 | nServicesExpected = NODE_NONE; |
| 2394 | hSocket = hSocketIn; |
| 2395 | nRecvVersion = INIT_PROTO_VERSION; |
| 2396 | nLastSend = 0; |
| 2397 | nLastRecv = 0; |
| 2398 | nSendBytes = 0; |
| 2399 | nRecvBytes = 0; |
| 2400 | nTimeConnected = GetTime(); |
| 2401 | addr = addrIn; |
| 2402 | addrName = addrNameIn == "" ? addr.ToStringIPPort() : addrNameIn; |
| 2403 | nVersion = 0; |
| 2404 | strSubVer = ""; |
| 2405 | fWhitelisted = false; |
| 2406 | fOneShot = false; |
| 2407 | fClient = false; // set by version message |
| 2408 | fInbound = fInboundIn; |
| 2409 | fNetworkNode = false; |
| 2410 | fSuccessfullyConnected = false; |
| 2411 | fDisconnect = false; |
| 2412 | nRefCount = 0; |
| 2413 | nSendSize = 0; |
| 2414 | nSendOffset = 0; |
| 2415 | hashContinue = 0; |
| 2416 | nStartingHeight = -1; |
| 2417 | fGetAddr = false; |
| 2418 | fRelayTxes = false; |
| 2419 | nNextLocalAddrSend = 0; |
| 2420 | nNextAddrSend = 0; |
| 2421 | nNextInvSend = 0; |
| 2422 | setInventoryKnown.max_size(SendBufferSize() / 1000); |
| 2423 | pfilter = new CBloomFilter(); |
| 2424 | nPingNonceSent = 0; |
| 2425 | nPingUsecStart = 0; |
| 2426 | nPingUsecTime = 0; |
| 2427 | fPingQueued = false; |
| 2428 | fDarkSendMaster = false; |
| 2429 | |
| 2430 | { |
| 2431 | LOCK(cs_nLastNodeId); |
| 2432 | id = nLastNodeId++; |
| 2433 | } |
| 2434 | |
| 2435 | if (fLogIPs) |
| 2436 | LogPrint("net", "Added connection to %s peer=%d\n", addrName, id); |
| 2437 | else |
| 2438 | LogPrint("net", "Added connection peer=%d\n", id); |
| 2439 | |
| 2440 | // Be shy and don't send version until we hear |
| 2441 | if (hSocket != INVALID_SOCKET && !fInbound) |
| 2442 | PushVersion(); |
| 2443 | |
| 2444 | GetNodeSignals().InitializeNode(GetId(), this); |
| 2445 | } |
| 2446 | |
| 2447 | CNode::~CNode() |
nothing calls this directly
no test coverage detected