MCPcopy Create free account
hub / github.com/apple/foundationdb / read

Function read

flow/Net2.actor.cpp:1065–1083  ·  view source on GitHub ↗

Reads as many bytes as possible from the read buffer into [begin,end) and returns the number of bytes read (might be 0)

Source from the content-addressed store, hash-verified

1063 // Reads as many bytes as possible from the read buffer into [begin,end) and returns the number of bytes read (might
1064 // be 0)
1065 int read(uint8_t* begin, uint8_t* end) override {
1066 boost::system::error_code err;
1067 ++g_net2->countReads;
1068 size_t toRead = end - begin;
1069 size_t size = ssl_sock.read_some(boost::asio::mutable_buffers_1(begin, toRead), err);
1070 g_net2->bytesReceived += size;
1071 //TraceEvent("ConnRead", this->id).detail("Bytes", size);
1072 if (err) {
1073 if (err == boost::asio::error::would_block) {
1074 ++g_net2->countWouldBlock;
1075 return 0;
1076 }
1077 onReadError(err);
1078 throw connection_failed();
1079 }
1080 ASSERT(size); // If the socket is closed, we expect an 'eof' error, not a zero return value
1081
1082 return size;
1083 }
1084
1085 // Writes as many bytes as possible from the given SendBuffer chain into the write buffer and returns the number of
1086 // bytes written (might be 0)

Callers 9

getRandomSeedFunction · 0.70
getCursorPositionFunction · 0.50
completeLineFunction · 0.50
linenoiseEditFunction · 0.50
linenoisePrintKeyCodesFunction · 0.50
readMethod · 0.50
AddressIsReadableFunction · 0.50
InitMethod · 0.50
callMethod · 0.50

Calls 1

onReadErrorFunction · 0.85

Tested by 1

callMethod · 0.40