MCPcopy Create free account
hub / github.com/FastLED/FastLED / read_some

Method read_some

src/fl/stl/asio/ip/tcp.cpp.hpp:248–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248size_t socket::read_some(fl::span<u8> buffer, error_code &ec) {
249 ec = error_code();
250 if (mFd == -1) {
251 ec = error_code(errc::operation_aborted, "socket not open");
252 return 0;
253 }
254
255 ssize_t result =
256 plat_recv(mFd, (char *)buffer.data(), buffer.size(), 0);
257
258 if (result < 0) {
259 if (is_would_block()) {
260 ec = error_code(errc::would_block);
261 return 0;
262 }
263#ifdef FL_IS_WIN
264 ec = error_code(errc::unknown, "recv failed");
265#else
266 ec = error_code::from_errno(errno);
267#endif
268 return 0;
269 }
270
271 if (result == 0) {
272 ec = error_code(errc::eof, "connection closed by peer");
273 return 0;
274 }
275
276 return static_cast<size_t>(result);
277}
278
279size_t socket::write_some(fl::span<const u8> buffer, error_code &ec) {
280 ec = error_code();

Callers 3

recvMethod · 0.80
recvMethod · 0.80
FL_TEST_FILEFunction · 0.80

Calls 5

error_codeClass · 0.85
plat_recvFunction · 0.85
is_would_blockFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by 1

FL_TEST_FILEFunction · 0.64