MCPcopy Create free account
hub / github.com/chrxh/alien / process_server_socket_core

Function process_server_socket_core

external/cpp-httplib/httplib.h:2495–2511  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2493
2494 template <typename T>
2495 inline bool
2496 process_server_socket_core(const std::atomic<socket_t>& svr_sock, socket_t sock,
2497 size_t keep_alive_max_count,
2498 time_t keep_alive_timeout_sec, T callback) {
2499 assert(keep_alive_max_count > 0);
2500 auto ret = false;
2501 auto count = keep_alive_max_count;
2502 while (svr_sock != INVALID_SOCKET && count > 0 &&
2503 keep_alive(sock, keep_alive_timeout_sec)) {
2504 auto close_connection = count == 1;
2505 auto connection_closed = false;
2506 ret = callback(close_connection, connection_closed);
2507 if (!ret || connection_closed) { break; }
2508 count--;
2509 }
2510 return ret;
2511 }
2512
2513 template <typename T>
2514 inline bool

Callers 2

process_server_socketFunction · 0.85

Calls 1

keep_aliveFunction · 0.85

Tested by

no test coverage detected