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

Method attach_server_session

src/proxy/http/HttpSM.cc:6598–6698  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6596}
6597
6598void
6599HttpSM::attach_server_session()
6600{
6601 hsm_release_assert(server_entry == nullptr);
6602 // In the h1 only origin version, the transact_count was updated after making this assignment.
6603 // The SSN-TXN-COUNT option in header rewrite relies on this fact, so we decrement here so the
6604 // plugin API interface is consistent as we move to more protocols to origin
6605 server_transact_count = server_txn->get_proxy_ssn()->get_transact_count() - 1;
6606
6607 // update the dst_addr when using an existing session
6608 // for e.g using Host based session pools may ignore the DNS IP
6609 IpEndpoint addr;
6610 addr.assign(server_txn->get_remote_addr());
6611 if (!ats_ip_addr_eq(&t_state.current.server->dst_addr, &addr)) {
6612 ip_port_text_buffer ipb1, ipb2;
6613 SMDbg(dbg_ctl_http_ss, "updating ip when attaching server session from %s to %s",
6614 ats_ip_ntop(&t_state.current.server->dst_addr.sa, ipb1, sizeof(ipb1)),
6615 ats_ip_ntop(server_txn->get_remote_addr(), ipb2, sizeof(ipb2)));
6616 ats_ip_copy(&t_state.current.server->dst_addr, server_txn->get_remote_addr());
6617 }
6618
6619 // Propagate the per client IP debugging
6620 if (_ua.get_txn()) {
6621 server_txn->get_netvc()->control_flags.set_flags(get_cont_flags().get_flags());
6622 } else { // If there is no _ua.get_txn() no sense in continuing to attach the server session
6623 return;
6624 }
6625
6626 // Set the mutex so that we have something to update
6627 // stats with
6628 server_txn->mutex = this->mutex;
6629
6630 server_txn->increment_transactions_stat();
6631
6632 // Record the VC in our table
6633 server_entry = vc_table.new_entry();
6634 server_entry->vc = server_txn;
6635 server_entry->vc_type = HTTP_SERVER_VC;
6636 server_entry->vc_write_handler = &HttpSM::state_send_server_request_header;
6637
6638 UnixNetVConnection *server_vc = static_cast<UnixNetVConnection *>(server_txn->get_netvc());
6639
6640 // set flag for server session is SSL
6641 if (server_vc->get_service<TLSBasicSupport>()) {
6642 server_connection_is_ssl = true;
6643 }
6644
6645 if (auto tsrs = server_vc->get_service<TLSSessionResumptionSupport>(); tsrs) {
6646 server_ssl_reused = tsrs->getSSLOriginSessionCacheHit();
6647 }
6648
6649 server_protocol = server_txn->get_protocol_string();
6650
6651 // Initiate a read on the session so that the SM and not
6652 // session manager will get called back if the timeout occurs
6653 // or the server closes on us. The IO Core now requires us to
6654 // do the read with a buffer and a size so preallocate the
6655 // buffer

Callers 5

tunnel_handler_serverMethod · 0.45
do_http_server_openMethod · 0.45
kill_thisMethod · 0.45
acquire_sessionMethod · 0.45

Calls 15

ats_ip_addr_eqFunction · 0.85
ats_ip_copyFunction · 0.85
get_cont_flagsFunction · 0.85
is_privateFunction · 0.85
get_proxy_ssnMethod · 0.80
get_txnMethod · 0.80
set_flagsMethod · 0.80
new_entryMethod · 0.80
presenceMethod · 0.80
value_appendMethod · 0.80

Tested by

no test coverage detected