Repository: trafficserver Updated Branches: refs/heads/6.0.x 1680acd23 -> e31e4e66c
[TS-3834] Close connection after sending GOAWAY Frame This closes #291 (cherry picked from commit e1ce42805c15e877e199a7a3da84640e52e8b416) Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/e31e4e66 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/e31e4e66 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/e31e4e66 Branch: refs/heads/6.0.x Commit: e31e4e66ceba503b391df073809815c7e3da081a Parents: 1680acd Author: Masaori Koshiba <[email protected]> Authored: Fri Sep 11 17:52:10 2015 +0900 Committer: Bryan Call <[email protected]> Committed: Fri Sep 11 13:53:06 2015 -0700 ---------------------------------------------------------------------- proxy/http2/Http2ClientSession.cc | 11 +++++++---- proxy/http2/Http2ClientSession.h | 11 +++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e31e4e66/proxy/http2/Http2ClientSession.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2ClientSession.cc b/proxy/http2/Http2ClientSession.cc index fe12b95..21f0466 100644 --- a/proxy/http2/Http2ClientSession.cc +++ b/proxy/http2/Http2ClientSession.cc @@ -61,7 +61,8 @@ send_connection_event(Continuation *cont, int event, void *edata) } Http2ClientSession::Http2ClientSession() - : con_id(0), client_vc(NULL), read_buffer(NULL), sm_reader(NULL), write_buffer(NULL), sm_writer(NULL), upgrade_context() + : con_id(0), total_write_len(0), client_vc(NULL), read_buffer(NULL), sm_reader(NULL), write_buffer(NULL), sm_writer(NULL), + upgrade_context() { } @@ -231,6 +232,8 @@ Http2ClientSession::main_event_handler(int event, void *edata) case HTTP2_SESSION_EVENT_XMIT: { Http2Frame *frame = (Http2Frame *)edata; + total_write_len += frame->size(); + write_vio->nbytes = total_write_len; frame->xmit(this->write_buffer); write_reenable(); return 0; @@ -243,10 +246,10 @@ Http2ClientSession::main_event_handler(int event, void *edata) this->do_io_close(); return 0; - case VC_EVENT_WRITE_COMPLETE: case VC_EVENT_WRITE_READY: - // After sending GOAWAY, close the connection - if (this->connection_state.is_state_closed() && write_vio->ntodo() <= 0) { + return 0; + case VC_EVENT_WRITE_COMPLETE: + if (this->connection_state.is_state_closed()) { this->do_io_close(); } return 0; http://git-wip-us.apache.org/repos/asf/trafficserver/blob/e31e4e66/proxy/http2/Http2ClientSession.h ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2ClientSession.h b/proxy/http2/Http2ClientSession.h index 99d384d..d0608d5 100644 --- a/proxy/http2/Http2ClientSession.h +++ b/proxy/http2/Http2ClientSession.h @@ -131,6 +131,16 @@ public: } } + int64_t + size() + { + if (ioblock) { + return ioblock->size(); + } else { + return sizeof(this->hdr.raw); + } + } + private: Http2Frame(Http2Frame &); // noncopyable Http2Frame &operator=(const Http2Frame &); // noncopyable @@ -213,6 +223,7 @@ private: int state_complete_frame_read(int, void *); int64_t con_id; + int64_t total_write_len; SessionHandler session_handler; NetVConnection *client_vc; MIOBuffer *read_buffer;
