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

Method readData

src/net.cpp:851–866  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

849}
850
851int CNetMessage::readData(const char *pch, unsigned int nBytes)
852{
853 unsigned int nRemaining = hdr.nMessageSize - nDataPos;
854 unsigned int nCopy = std::min(nRemaining, nBytes);
855
856 if (vRecv.size() < nDataPos + nCopy) {
857 // Allocate up to 256 KiB ahead, but never more than the total message size.
858 vRecv.resize(std::min(hdr.nMessageSize, nDataPos + nCopy + 256 * 1024));
859 }
860
861 hasher.Write((const unsigned char*)pch, nCopy);
862 memcpy(&vRecv[nDataPos], pch, nCopy);
863 nDataPos += nCopy;
864
865 return nCopy;
866}
867
868const uint256& CNetMessage::GetMessageHash() const
869{

Callers 1

ReceiveMsgBytesMethod · 0.80

Calls 4

memcpyFunction · 0.85
sizeMethod · 0.45
resizeMethod · 0.45
WriteMethod · 0.45

Tested by

no test coverage detected