nghttpd: Start SETTINGS timer after it is written to output buffer

This commit is contained in:
Tatsuhiro Tsujikawa 2016-02-23 01:18:07 +09:00
parent 3e72711e23
commit 9d15f9b00d
2 changed files with 14 additions and 2 deletions

View File

@ -577,6 +577,10 @@ Http2Handler::WriteBuf *Http2Handler::get_wb() { return &wb_; }
int Http2Handler::setup_bev() { return 0; }
void Http2Handler::start_settings_timer() {
ev_timer_start(sessions_->get_loop(), &settings_timerev_);
}
int Http2Handler::fill_wb() {
if (data_pending_) {
auto n = std::min(wb_.wleft(), data_pendinglen_);
@ -870,8 +874,6 @@ int Http2Handler::connection_made() {
}
}
ev_timer_start(sessions_->get_loop(), &settings_timerev_);
if (ssl_ && !nghttp2::ssl::check_http2_requirement(ssl_)) {
terminate_session(NGHTTP2_INADEQUATE_SECURITY);
}
@ -1538,6 +1540,15 @@ int hd_on_frame_send_callback(nghttp2_session *session,
break;
}
case NGHTTP2_SETTINGS: {
if (frame->hd.flags & NGHTTP2_FLAG_ACK) {
return 0;
}
hd->start_settings_timer();
break;
}
case NGHTTP2_PUSH_PROMISE: {
auto promised_stream_id = frame->push_promise.promised_stream_id;
auto promised_stream = hd->get_stream(promised_stream_id);

View File

@ -138,6 +138,7 @@ public:
void remove_self();
int setup_bev();
void start_settings_timer();
int on_read();
int on_write();
int connection_made();