HttpServer: Fix left_connhd_len_ is not updated

This commit is contained in:
Tatsuhiro Tsujikawa 2013-07-26 21:34:39 +09:00
parent 32bd1425b4
commit 9b27160195
2 changed files with 7 additions and 0 deletions

View File

@ -271,6 +271,7 @@ void connhd_readcb(bufferevent *bev, void *ptr)
return; return;
} }
leftlen -= readlen; leftlen -= readlen;
handler->set_left_connhd_len(leftlen);
if(leftlen == 0) { if(leftlen == 0) {
bufferevent_setcb(bev, readcb, writecb, eventcb, ptr); bufferevent_setcb(bev, readcb, writecb, eventcb, ptr);
// Run on_read to process data left in buffer since they are not // Run on_read to process data left in buffer since they are not
@ -507,6 +508,11 @@ size_t Http2Handler::get_left_connhd_len() const
return left_connhd_len_; return left_connhd_len_;
} }
void Http2Handler::set_left_connhd_len(size_t left)
{
left_connhd_len_ = left;
}
namespace { namespace {
ssize_t hd_send_callback(nghttp2_session *session, ssize_t hd_send_callback(nghttp2_session *session,
const uint8_t *data, size_t len, int flags, const uint8_t *data, size_t len, int flags,

View File

@ -111,6 +111,7 @@ public:
Sessions* get_sessions() const; Sessions* get_sessions() const;
const Config* get_config() const; const Config* get_config() const;
size_t get_left_connhd_len() const; size_t get_left_connhd_len() const;
void set_left_connhd_len(size_t left);
private: private:
nghttp2_session *session_; nghttp2_session *session_;
Sessions *sessions_; Sessions *sessions_;