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

Method new_connection

src/proxy/http2/Http2ServerSession.cc:96–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void
97Http2ServerSession::new_connection(NetVConnection *new_vc, MIOBuffer *iobuf, IOBufferReader *reader)
98{
99 ink_assert(new_vc->mutex->thread_holding == this_ethread());
100
101 Metrics::Gauge::increment(http2_rsb.current_server_session_count);
102 Metrics::Counter::increment(http2_rsb.total_server_connection_count);
103 this->_milestones.mark(Http2SsnMilestone::OPEN);
104
105 // Unique client session identifier.
106 this->con_id = ProxySession::next_connection_id();
107 this->_vc = new_vc;
108 _vc->set_inactivity_timeout(HRTIME_SECONDS(Http2::accept_no_activity_timeout));
109 this->schedule_event = nullptr;
110 this->mutex = new_vc->mutex;
111
112 this->connection_state.mutex = this->mutex;
113
114 // Since we're functioning as a client, we do not need to worry about
115 // TLSEarlyDataSupport.
116
117 Http2SsnDebug("session born, netvc %p", this->_vc);
118
119 this->_vc->set_tcp_congestion_control(NetVConnection::tcp_congestion_control_side::CLIENT_SIDE);
120
121 this->read_buffer = iobuf ? iobuf : new_MIOBuffer(HTTP2_HEADER_BUFFER_SIZE_INDEX);
122 this->read_buffer->water_mark = connection_state.local_settings.get(HTTP2_SETTINGS_MAX_FRAME_SIZE);
123 this->_read_buffer_reader = reader ? reader : this->read_buffer->alloc_reader();
124
125 // Set write buffer size to max size of TLS record (16KB)
126 // This block size is the buffer size that we pass to SSLWriteBuffer
127 auto buffer_block_size_index = iobuffer_size_to_index(Http2::write_buffer_block_size, MAX_BUFFER_SIZE_INDEX);
128 this->write_buffer = new_MIOBuffer(buffer_block_size_index);
129 this->_write_buffer_reader = this->write_buffer->alloc_reader();
130 this->_write_size_threshold = index_to_buffer_size(buffer_block_size_index) * Http2::write_size_threshold;
131
132 uint32_t buffer_water_mark;
133 if (auto snis = this->_vc->get_service<TLSSNISupport>(); snis && snis->hints_from_sni.http2_buffer_water_mark.has_value()) {
134 buffer_water_mark = snis->hints_from_sni.http2_buffer_water_mark.value();
135 } else {
136 buffer_water_mark = Http2::buffer_water_mark;
137 }
138 this->write_buffer->water_mark = buffer_water_mark;
139
140 this->_handle_if_ssl(new_vc);
141
142 do_api_callout(TS_HTTP_SSN_START_HOOK);
143
144 this->add_session();
145}
146
147// implement that. After we send a GOAWAY, there
148// are scenarios where we would like to complete the outstanding streams.

Callers 1

acceptMethod · 0.45

Calls 13

add_sessionMethod · 0.95
this_ethreadFunction · 0.85
incrementFunction · 0.85
iobuffer_size_to_indexFunction · 0.85
index_to_buffer_sizeFunction · 0.85
alloc_readerMethod · 0.80
_handle_if_sslMethod · 0.80
markMethod · 0.45
getMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected