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

Method create_server_session

src/proxy/http/HttpSM.cc:1718–1751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1716}
1717
1718PoolableSession *
1719HttpSM::create_server_session(NetVConnection &netvc, MIOBuffer *netvc_read_buffer, IOBufferReader *netvc_reader)
1720{
1721 // Figure out what protocol was negotiated
1722 int proto_index = SessionProtocolNameRegistry::INVALID;
1723 if (auto const alpn = netvc.get_service<ALPNSupport>(); alpn) {
1724 proto_index = alpn->get_negotiated_protocol_id();
1725 }
1726 // No ALPN occurred. Assume it was HTTP/1.x and hope for the best
1727 if (proto_index == SessionProtocolNameRegistry::INVALID) {
1728 proto_index = TS_ALPN_PROTOCOL_INDEX_HTTP_1_1;
1729 }
1730
1731 PoolableSession *retval = ProxySession::create_outbound_session(proto_index);
1732
1733 retval->sharing_pool = static_cast<TSServerSessionSharingPoolType>(t_state.http_config_param->server_session_sharing_pool);
1734 retval->sharing_match = static_cast<TSServerSessionSharingMatchMask>(t_state.txn_conf->server_session_sharing_match);
1735 retval->attach_hostname(t_state.current.server->name);
1736 retval->new_connection(&netvc, netvc_read_buffer, netvc_reader);
1737
1738 ATS_PROBE1(new_origin_server_connection, t_state.current.server->name);
1739 retval->set_active();
1740
1741 ats_ip_copy(&t_state.server_info.src_addr, netvc.get_local_addr());
1742
1743 // If origin_max_connections or origin_min_keep_alive_connections is set then we are metering
1744 // the max and or min number of connections per host. Transfer responsibility for this to the
1745 // session object.
1746 if (t_state.outbound_conn_track_state.is_active()) {
1747 SMDbg(dbg_ctl_http_connect, "max number of outbound connections: %d", t_state.txn_conf->connection_tracker_config.server_max);
1748 retval->enable_outbound_connection_tracking(t_state.outbound_conn_track_state.drop());
1749 }
1750 return retval;
1751}
1752
1753bool
1754HttpSM::create_server_txn(PoolableSession *new_session)

Callers 2

Calls 9

ats_ip_copyFunction · 0.85
attach_hostnameMethod · 0.80
dropMethod · 0.80
new_connectionMethod · 0.45
set_activeMethod · 0.45
get_local_addrMethod · 0.45
is_activeMethod · 0.45

Tested by

no test coverage detected