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

Method attach_server_session

src/proxy/http/Http1ClientSession.cc:486–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484}
485
486bool
487Http1ClientSession::attach_server_session(PoolableSession *ssession, bool transaction_done)
488{
489 if (ssession) {
490 ink_assert(bound_ss == nullptr);
491 ssession->state = PoolableSession::KA_RESERVED;
492 bound_ss = ssession;
493 HttpSsnDbg("[%" PRId64 "] attaching server session [%" PRId64 "] as slave", con_id, ssession->connection_id());
494 ink_assert(ssession->get_netvc() != this->get_netvc());
495
496 // handling potential keep-alive here
497 clear_session_active();
498
499 // Since this our slave, issue an IO to detect a close and
500 // have it call the client session back. This IO also prevent
501 // the server net connection from calling back a dead sm
502 SET_HANDLER(&Http1ClientSession::state_keep_alive);
503 slave_ka_vio = ssession->do_io_read(this, INT64_MAX, ssession->get_remote_reader()->mbuf);
504 ink_assert(slave_ka_vio != ka_vio);
505
506 // Transfer control of the write side as well
507 ssession->do_io_write(this, 0, nullptr);
508
509 if (transaction_done) {
510 ssession->set_inactivity_timeout(HRTIME_SECONDS(trans.get_sm()->t_state.txn_conf->keep_alive_no_activity_timeout_out));
511 ssession->cancel_active_timeout();
512 } else {
513 // we are serving from the cache - this could take a while.
514 ssession->cancel_inactivity_timeout();
515 ssession->cancel_active_timeout();
516 }
517 } else {
518 ink_assert(bound_ss != nullptr);
519 bound_ss = nullptr;
520 slave_ka_vio = nullptr;
521 }
522 return true;
523}
524
525void
526Http1ClientSession::increment_current_active_connections_stat()

Callers

nothing calls this directly

Calls 9

get_smMethod · 0.80
connection_idMethod · 0.45
get_netvcMethod · 0.45
do_io_readMethod · 0.45
get_remote_readerMethod · 0.45
do_io_writeMethod · 0.45
cancel_active_timeoutMethod · 0.45

Tested by

no test coverage detected