MCPcopy Create free account
hub / github.com/apache/trafficserver / _close_ne

Method _close_ne

src/iocore/net/NetHandler.cc:497–535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

495}
496
497void
498NetHandler::_close_ne(NetEvent *ne, ink_hrtime now, int &handle_event, int &closed, int &total_idle_time, int &total_idle_count)
499{
500 if (ne->get_thread() != this_ethread()) {
501 return;
502 }
503 MUTEX_TRY_LOCK(lock, ne->get_mutex(), this_ethread());
504 if (!lock.is_locked()) {
505 return;
506 }
507 ink_hrtime diff = (now - (ne->next_inactivity_timeout_at - ne->inactivity_timeout_in)) / HRTIME_SECOND;
508 if (diff > 0) {
509 total_idle_time += diff;
510 ++total_idle_count;
511 Metrics::Counter::increment(net_rsb.keep_alive_queue_timeout_total, diff);
512 Metrics::Counter::increment(net_rsb.keep_alive_queue_timeout_count);
513 }
514 Dbg(dbg_ctl_net_queue, "closing connection NetEvent=%p idle: %u now: %" PRId64 " at: %" PRId64 " in: %" PRId64 " diff: %" PRId64,
515 ne, keep_alive_queue_size, ink_hrtime_to_sec(now), ink_hrtime_to_sec(ne->next_inactivity_timeout_at),
516 ink_hrtime_to_sec(ne->inactivity_timeout_in), diff);
517 if (ne->closed) {
518 free_netevent(ne);
519 ++closed;
520 } else {
521 ne->next_inactivity_timeout_at = now;
522 // create a dummy event
523 Event event;
524 event.ethread = this_ethread();
525 if (ne->inactivity_timeout_in && ne->next_inactivity_timeout_at <= now) {
526 if (ne->callback(VC_EVENT_INACTIVITY_TIMEOUT, &event) == EVENT_DONE) {
527 ++handle_event;
528 }
529 } else if (ne->active_timeout_in && ne->next_activity_timeout_at <= now) {
530 if (ne->callback(VC_EVENT_ACTIVE_TIMEOUT, &event) == EVENT_DONE) {
531 ++handle_event;
532 }
533 }
534 }
535}
536
537void
538NetHandler::add_to_keep_alive_queue(NetEvent *ne)

Callers

nothing calls this directly

Calls 5

this_ethreadFunction · 0.85
incrementFunction · 0.85
ink_hrtime_to_secFunction · 0.85
get_threadMethod · 0.80
callbackMethod · 0.45

Tested by

no test coverage detected