| 3292 | |
| 3293 | template <typename T> |
| 3294 | inline bool |
| 3295 | process_server_socket_core(const std::atomic<socket_t> &svr_sock, socket_t sock, |
| 3296 | size_t keep_alive_max_count, |
| 3297 | time_t keep_alive_timeout_sec, T callback) { |
| 3298 | assert(keep_alive_max_count > 0); |
| 3299 | auto ret = false; |
| 3300 | auto count = keep_alive_max_count; |
| 3301 | while (count > 0 && keep_alive(svr_sock, sock, keep_alive_timeout_sec)) { |
| 3302 | auto close_connection = count == 1; |
| 3303 | auto connection_closed = false; |
| 3304 | ret = callback(close_connection, connection_closed); |
| 3305 | if (!ret || connection_closed) { break; } |
| 3306 | count--; |
| 3307 | } |
| 3308 | return ret; |
| 3309 | } |
| 3310 | |
| 3311 | template <typename T> |
| 3312 | inline bool |
no test coverage detected