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

Method ReceiveMsgBytes

src/net.cpp:559–593  ·  view source on GitHub ↗

requires LOCK(cs_vRecvMsg)

Source from the content-addressed store, hash-verified

557
558// requires LOCK(cs_vRecvMsg)
559bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes)
560{
561 while (nBytes > 0) {
562
563 // get current incomplete message, or create a new one
564 if (vRecvMsg.empty() ||
565 vRecvMsg.back().complete())
566 vRecvMsg.push_back(CNetMessage(Params().MessageStart(), SER_NETWORK, nRecvVersion));
567
568 CNetMessage& msg = vRecvMsg.back();
569
570 // absorb network data
571 int handled;
572 if (!msg.in_data)
573 handled = msg.readHeader(pch, nBytes);
574 else
575 handled = msg.readData(pch, nBytes);
576
577 if (handled < 0)
578 return false;
579
580 if (msg.in_data && !g_signals.SanityCheckMessages(this, boost::ref(msg)))
581 return false;
582
583 pch += handled;
584 nBytes -= handled;
585
586 if (msg.complete()) {
587 msg.nTime = GetTimeMicros();
588 messageHandlerCondition.notify_one();
589 }
590 }
591
592 return true;
593}
594
595unsigned int CNetMessage::FinalizeHeader(CDataStream& s)
596{

Callers 2

BOOST_FOREACHFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 8

CNetMessageClass · 0.85
GetTimeMicrosFunction · 0.85
completeMethod · 0.80
readHeaderMethod · 0.80
readDataMethod · 0.80
ParamsClass · 0.70
emptyMethod · 0.45
push_backMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.64