Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions proxy/http2/Http2ClientSession.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ Http2ClientSession::start()
VIO *read_vio = this->do_io_read(this, INT64_MAX, this->read_buffer);
write_vio = this->do_io_write(this, INT64_MAX, this->_write_buffer_reader);

this->connection_state.init();
send_connection_event(&this->connection_state, HTTP2_SESSION_EVENT_INIT, this);
this->connection_state.init(this);
this->connection_state.send_connection_preface();

if (this->_read_buffer_reader->is_read_avail_more_than(0)) {
this->handleEvent(VC_EVENT_READ_READY, read_vio);
Expand Down
56 changes: 28 additions & 28 deletions proxy/http2/Http2ConnectionState.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,9 @@ Http2ConnectionState::Http2ConnectionState() : stream_list()
}

void
Http2ConnectionState::init()
Http2ConnectionState::init(Http2ClientSession *ssn)
{
ua_session = ssn;
this->_server_rwnd = Http2::initial_window_size;

local_hpack_handle = new HpackHandle(HTTP2_HEADER_TABLE_SIZE);
Expand All @@ -1054,6 +1055,32 @@ Http2ConnectionState::init()
_cop.start();
}

/**
Send connection preface

The client connection preface is HTTP2_CONNECTION_PREFACE.
The server connection preface consists of a potentially emptry SETTINGS frame.

Details in [RFC 7540] 3.5. HTTP/2 Connection Preface

TODO: send client connection preface if the connection is outbound
*/
void
Http2ConnectionState::send_connection_preface()
{
REMEMBER(NO_EVENT, this->recursion)

Http2ConnectionSettings configured_settings;
configured_settings.settings_from_configs();
configured_settings.set(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, _adjust_concurrent_stream());

send_settings_frame(configured_settings);

if (server_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE) > HTTP2_INITIAL_WINDOW_SIZE) {
send_window_update_frame(0, server_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE) - HTTP2_INITIAL_WINDOW_SIZE);
}
}

void
Http2ConnectionState::destroy()
{
Expand Down Expand Up @@ -1100,33 +1127,6 @@ Http2ConnectionState::main_event_handler(int event, void *edata)
}
++recursion;
switch (event) {
// Initialize HTTP/2 Connection
case HTTP2_SESSION_EVENT_INIT: {
ink_assert(this->ua_session == nullptr);
this->ua_session = static_cast<Http2ClientSession *>(edata);
REMEMBER(event, this->recursion);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've been losing hints by removing calls for REMEMBER(). Isn't it worth keeping it? I'm fine with remove it temporally but want to put them back before we release 9.2.x (assuming we don't have this change on 9.1).

Copy link
Copy Markdown
Contributor Author

@masaori335 masaori335 May 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I'll put it back for now.

We might need to revisit which function call should be recorded with the #7845 change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we should reconsider where to put it on the restructuring. We may remove this one after all, but current places were considered as places that may help debugging. It would be nice to keep for future discussion.


// [RFC 7540] 3.5. HTTP/2 Connection Preface. Upon establishment of a TCP connection and
// determination that HTTP/2 will be used by both peers, each endpoint MUST
// send a connection preface as a final confirmation ... The server
// connection
// preface consists of a potentially empty SETTINGS frame.

// Load the server settings from the records.config / RecordsConfig.cc
// settings.
Http2ConnectionSettings configured_settings;
configured_settings.settings_from_configs();
configured_settings.set(HTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, _adjust_concurrent_stream());

send_settings_frame(configured_settings);

if (server_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE) > HTTP2_INITIAL_WINDOW_SIZE) {
send_window_update_frame(0, server_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE) - HTTP2_INITIAL_WINDOW_SIZE);
}

break;
}

// Finalize HTTP/2 Connection
case HTTP2_SESSION_EVENT_FINI: {
SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
Expand Down
3 changes: 2 additions & 1 deletion proxy/http2/Http2ConnectionState.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ class Http2ConnectionState : public Continuation
Http2ConnectionSettings server_settings;
Http2ConnectionSettings client_settings;

void init();
void init(Http2ClientSession *ssn);
void send_connection_preface();
void destroy();

// Event handlers
Expand Down