Changeset View
Changeset View
Standalone View
Standalone View
src/net.cpp
Show First 20 Lines • Show All 710 Lines • ▼ Show 20 Lines | int V1TransportDeserializer::readData(const char *pch, uint32_t nBytes) { | ||||
unsigned int nCopy = std::min(nRemaining, nBytes); | unsigned int nCopy = std::min(nRemaining, nBytes); | ||||
if (vRecv.size() < nDataPos + nCopy) { | if (vRecv.size() < nDataPos + nCopy) { | ||||
// Allocate up to 256 KiB ahead, but never more than the total message | // Allocate up to 256 KiB ahead, but never more than the total message | ||||
// size. | // size. | ||||
vRecv.resize(std::min(hdr.nMessageSize, nDataPos + nCopy + 256 * 1024)); | vRecv.resize(std::min(hdr.nMessageSize, nDataPos + nCopy + 256 * 1024)); | ||||
} | } | ||||
hasher.Write((const uint8_t *)pch, nCopy); | hasher.Write({(const uint8_t *)pch, nCopy}); | ||||
memcpy(&vRecv[nDataPos], pch, nCopy); | memcpy(&vRecv[nDataPos], pch, nCopy); | ||||
nDataPos += nCopy; | nDataPos += nCopy; | ||||
return nCopy; | return nCopy; | ||||
} | } | ||||
const uint256 &V1TransportDeserializer::GetMessageHash() const { | const uint256 &V1TransportDeserializer::GetMessageHash() const { | ||||
assert(Complete()); | assert(Complete()); | ||||
▲ Show 20 Lines • Show All 2,459 Lines • Show Last 20 Lines |