diff options
Diffstat (limited to 'src/http.h')
| -rw-r--r-- | src/http.h | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -202,7 +202,9 @@ public: virtual const struct sockaddr * SockAddrDest() const = 0; virtual void Write(std::unique_ptr<HttpSession> http_session) = 0; - virtual void Close() = 0; + + virtual void CloseImmediately() = 0; + virtual void ClosePeacefully(bool eof_upstream, bool eof_downstream) = 0; protected: http_connection_cb_t session_new_cb_{nullptr}; @@ -367,7 +369,7 @@ private: } }; -std::unique_ptr<HttpRequest> HttpRequestFactory(int primary_version, int second_version); +std::unique_ptr<HttpRequest> HttpRequestFactory(short major_version, short minor_version); std::unique_ptr<HttpResponse> HttpResponseFactory(short major_version, short minor_version); #include "pxyconn.h" @@ -382,9 +384,15 @@ public: ~Http1Connection() = default; - void Close() override + void CloseImmediately() override { need_to_close_ = true; }; + void ClosePeacefully(bool eof_upstream, bool eof_downstream) override + { + if (eof_upstream) bufferevent_trigger_event(bev_upstream_, BEV_EVENT_EOF, 0); + if (eof_downstream) bufferevent_trigger_event(bev_downstream_, BEV_EVENT_EOF, 0); + } + bool NeedToClose() { return need_to_close_; } |
