MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / is_socket_alive

Function is_socket_alive

examples/server/httplib.h:2504–2513  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2502}
2503
2504inline bool is_socket_alive(socket_t sock) {
2505 const auto val = detail::select_read(sock, 0, 0);
2506 if (val == 0) {
2507 return true;
2508 } else if (val < 0 && errno == EBADF) {
2509 return false;
2510 }
2511 char buf[1];
2512 return detail::read_socket(sock, &buf[0], sizeof(buf), MSG_PEEK) > 0;
2513}
2514
2515class SocketStream : public Stream {
2516public:

Callers 2

is_writableMethod · 0.85
send_Method · 0.85

Calls 2

select_readFunction · 0.85
read_socketFunction · 0.85

Tested by

no test coverage detected