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

Method init

src/proxy/http2/Http2ConnectionState.cc:1277–1343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1275}
1276
1277void
1278Http2ConnectionState::init(Http2CommonSession *ssn)
1279{
1280 session = ssn;
1281 uint32_t const configured_session_window = this->_get_configured_receive_session_window_size();
1282
1283 if (configured_session_window < HTTP2_INITIAL_WINDOW_SIZE) {
1284 // There is no HTTP/2 specified way to shrink the connection window size
1285 // other than to receive data and not send WINDOW_UPDATE frames for a
1286 // while.
1287 this->_local_rwnd = HTTP2_INITIAL_WINDOW_SIZE;
1288 this->_local_rwnd_is_shrinking = true;
1289 } else {
1290 this->_local_rwnd = configured_session_window;
1291 this->_local_rwnd_is_shrinking = false;
1292 }
1293 Http2ConDebug(session, "initial _local_rwnd: %zd", this->_local_rwnd);
1294
1295 local_hpack_handle = new HpackHandle(HTTP2_HEADER_TABLE_SIZE);
1296 peer_hpack_handle = new HpackHandle(HTTP2_HEADER_TABLE_SIZE);
1297 if (Http2::stream_priority_enabled) {
1298 dependency_tree = new DependencyTree(this->_get_configured_max_concurrent_streams());
1299 }
1300
1301 // Generally speaking, before enforcing h2 settings we wait upon the client to
1302 // acknowledge the settings via a SETTINGS ACK. This is important for things
1303 // like correctly handling windows. Howerver, the RFC default values for
1304 // MAX_CONCURRENT_STREAMS and MAX_HEADER_SIZE are infinite, which is not
1305 // practical and a client can run ATS out of resources by simply opening up
1306 // more streams than is reasonable. We enforce our configured defaults before
1307 // the client ACKs our SETTINGS by setting the configured defaults in the
1308 // acknowledged settings.
1309 Http2ConnectionSettings configured_settings;
1310 configured_settings.settings_from_configs(session->is_outbound());
1311 acknowledged_local_settings.set(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS,
1312 configured_settings.get(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS));
1313 acknowledged_local_settings.set(HTTP2_SETTINGS_MAX_HEADER_LIST_SIZE,
1314 configured_settings.get(HTTP2_SETTINGS_MAX_HEADER_LIST_SIZE));
1315
1316 configured_max_settings_frames_per_minute = Http2::max_settings_frames_per_minute;
1317 configured_max_ping_frames_per_minute = Http2::max_ping_frames_per_minute;
1318 configured_max_priority_frames_per_minute = Http2::max_priority_frames_per_minute;
1319 configured_max_rst_stream_frames_per_minute = Http2::max_rst_stream_frames_per_minute;
1320 configured_max_continuation_frames_per_minute = Http2::max_continuation_frames_per_minute;
1321 configured_max_empty_frames_per_minute = Http2::max_empty_frames_per_minute;
1322
1323 if (auto snis = session->get_netvc()->get_service<TLSSNISupport>(); snis) {
1324 if (snis->hints_from_sni.http2_max_settings_frames_per_minute.has_value()) {
1325 configured_max_settings_frames_per_minute = snis->hints_from_sni.http2_max_settings_frames_per_minute.value();
1326 }
1327 if (snis->hints_from_sni.http2_max_ping_frames_per_minute.has_value()) {
1328 configured_max_ping_frames_per_minute = snis->hints_from_sni.http2_max_ping_frames_per_minute.value();
1329 }
1330 if (snis->hints_from_sni.http2_max_priority_frames_per_minute.has_value()) {
1331 configured_max_priority_frames_per_minute = snis->hints_from_sni.http2_max_priority_frames_per_minute.value();
1332 }
1333 if (snis->hints_from_sni.http2_max_rst_stream_frames_per_minute.has_value()) {
1334 configured_max_rst_stream_frames_per_minute = snis->hints_from_sni.http2_max_rst_stream_frames_per_minute.value();

Callers

nothing calls this directly

Calls 10

settings_from_configsMethod · 0.80
is_outboundMethod · 0.45
setMethod · 0.45
getMethod · 0.45
get_netvcMethod · 0.45
has_valueMethod · 0.45
valueMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected