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

Method readData

src/net.cpp:642–656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

640}
641
642int CNetMessage::readData(const char *pch, unsigned int nBytes)
643{
644 unsigned int nRemaining = hdr.nMessageSize - nDataPos;
645 unsigned int nCopy = std::min(nRemaining, nBytes);
646
647 if (vRecv.size() < nDataPos + nCopy) {
648 // Allocate up to 256 KiB ahead, but never more than the total message size.
649 vRecv.resize(std::min(hdr.nMessageSize, nDataPos + nCopy + 256 * 1024));
650 }
651
652 memcpy(&vRecv[nDataPos], pch, nCopy);
653 nDataPos += nCopy;
654
655 return nCopy;
656}
657
658
659

Callers 1

ReceiveMsgBytesMethod · 0.80

Calls 3

memcpyFunction · 0.85
resizeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected