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

Method recv

src/fl/stl/asio/http/native_client.cpp.hpp:99–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99int NativeHttpClient::recv(fl::span<u8> buffer) {
100 if (!isConnected() || !mSocket.is_open()) {
101 return -1;
102 }
103
104 asio::error_code ec;
105 size_t n = mSocket.read_some(buffer, ec);
106
107 if (ec) {
108 if (ec.code == asio::errc::would_block) {
109 return 0; // Non-blocking socket, no data available
110 }
111 // Connection error or EOF
112 mConnection.onDisconnected();
113 return -1;
114 }
115
116 // Data received, update heartbeat tracking
117 mConnection.onHeartbeatReceived();
118
119 return static_cast<int>(n);
120}
121
122void NativeHttpClient::update(u32 currentTimeMs) {
123 // Update connection state machine

Callers 6

recvDataMethod · 0.45
recvDataMethod · 0.45
readHttpRequestHeaderMethod · 0.45
FL_TEST_FILEFunction · 0.45
FL_TEST_FILEFunction · 0.45

Calls 4

read_someMethod · 0.80
onDisconnectedMethod · 0.80
is_openMethod · 0.45
onHeartbeatReceivedMethod · 0.45

Tested by

no test coverage detected