| 458 | } |
| 459 | |
| 460 | void |
| 461 | NetHandler::manage_keep_alive_queue() |
| 462 | { |
| 463 | uint32_t total_connections_in = active_queue_size + keep_alive_queue_size; |
| 464 | ink_hrtime now = ink_get_hrtime(); |
| 465 | |
| 466 | Dbg(dbg_ctl_v_net_queue, |
| 467 | "max_connections_per_thread_in: %d total_connections_in: %d active_queue_size: %d keep_alive_queue_size: %d", |
| 468 | max_connections_per_thread_in, total_connections_in, active_queue_size, keep_alive_queue_size); |
| 469 | |
| 470 | if (!max_connections_per_thread_in || total_connections_in <= max_connections_per_thread_in) { |
| 471 | return; |
| 472 | } |
| 473 | |
| 474 | // loop over the non-active connections and try to close them |
| 475 | NetEvent *ne_next = nullptr; |
| 476 | int closed = 0; |
| 477 | int handle_event = 0; |
| 478 | int total_idle_time = 0; |
| 479 | int total_idle_count = 0; |
| 480 | for (NetEvent *ne = keep_alive_queue.head; ne != nullptr; ne = ne_next) { |
| 481 | ne_next = ne->keep_alive_queue_link.next; |
| 482 | _close_ne(ne, now, handle_event, closed, total_idle_time, total_idle_count); |
| 483 | |
| 484 | total_connections_in = active_queue_size + keep_alive_queue_size; |
| 485 | if (total_connections_in <= max_connections_per_thread_in) { |
| 486 | break; |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | if (total_idle_count > 0) { |
| 491 | Dbg(dbg_ctl_net_queue, "max cons: %d active: %d idle: %d already closed: %d, close event: %d mean idle: %d", |
| 492 | max_connections_per_thread_in, total_connections_in, keep_alive_queue_size, closed, handle_event, |
| 493 | total_idle_time / total_idle_count); |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | void |
| 498 | NetHandler::_close_ne(NetEvent *ne, ink_hrtime now, int &handle_event, int &closed, int &total_idle_time, int &total_idle_count) |
no test coverage detected