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

Function process_server_socket_core

examples/server/httplib.h:2589–2605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2587
2588template <typename T>
2589inline bool
2590process_server_socket_core(const std::atomic<socket_t> &svr_sock, socket_t sock,
2591 size_t keep_alive_max_count,
2592 time_t keep_alive_timeout_sec, T callback) {
2593 assert(keep_alive_max_count > 0);
2594 auto ret = false;
2595 auto count = keep_alive_max_count;
2596 while (svr_sock != INVALID_SOCKET && count > 0 &&
2597 keep_alive(sock, keep_alive_timeout_sec)) {
2598 auto close_connection = count == 1;
2599 auto connection_closed = false;
2600 ret = callback(close_connection, connection_closed);
2601 if (!ret || connection_closed) { break; }
2602 count--;
2603 }
2604 return ret;
2605}
2606
2607template <typename T>
2608inline bool

Callers 2

process_server_socketFunction · 0.85

Calls 1

keep_aliveFunction · 0.85

Tested by

no test coverage detected