MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / loop_rx

Method loop_rx

OpenHD/ohd_common/src/openhd_tcp.cpp:137–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

135}
136
137void openhd::TCPServer::ConnectedClient::loop_rx() {
138 auto console = openhd::log::create_or_get(fmt::format("TCPClient{}", ip));
139 const auto buff = std::make_unique<std::array<uint8_t, READ_BUFF_SIZE>>();
140 while (keep_rx_looping) {
141 const ssize_t message_length = read(sock_fd, buff->data(), buff->size());
142 if (message_length < 0) {
143 console->debug("Read error {} {}", message_length, strerror(errno));
144 marked_to_be_removed = true;
145 break;
146 }
147 if (message_length == 0) {
148 console->debug("Client disconnected");
149 marked_to_be_removed = true;
150 break;
151 }
152 parent->on_packet_any_tcp_client(buff->data(), message_length);
153 }
154 parent->on_external_device(ip, port, false);
155}

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.80
debugMethod · 0.80
on_external_deviceMethod · 0.45

Tested by

no test coverage detected