diff options
author | linuxdaemon <linuxdaemon@users.noreply.github.com> | 2019-05-22 13:47:17 -0500 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2019-05-22 19:47:17 +0100 |
commit | de7011e54ad88656e01c92a88dd053a94b5acc6b (patch) | |
tree | 713d80e075dd880f0d635eee297bd313441b0337 /include/inspsocket.h | |
parent | 05756b842f26c647e527ec186c192c8cf448113f (diff) |
Add an overload of StreamSocket::Close which closes when all data has been written.
Fixes sending large pages in m_httpd (#1646).
Diffstat (limited to 'include/inspsocket.h')
-rw-r--r-- | include/inspsocket.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/inspsocket.h b/include/inspsocket.h index a41c3ebc7..a07c2eb6f 100644 --- a/include/inspsocket.h +++ b/include/inspsocket.h @@ -227,6 +227,12 @@ class CoreExport StreamSocket : public EventHandler }; private: + /** Whether this socket should close once its sendq is empty */ + bool closeonempty; + + /** Whether the socket is currently closing or not, used to avoid repeatedly closing a closed socket */ + bool closing; + /** The IOHook that handles raw I/O for this socket, or NULL */ IOHook* iohook; @@ -273,7 +279,9 @@ class CoreExport StreamSocket : public EventHandler public: const Type type; StreamSocket(Type sstype = SS_UNKNOWN) - : iohook(NULL) + : closeonempty(false) + , closing(false) + , iohook(NULL) , type(sstype) { } @@ -334,6 +342,10 @@ class CoreExport StreamSocket : public EventHandler * Close the socket, remove from socket engine, etc */ virtual void Close(); + + /** If writeblock is true then only close the socket if all data has been sent. Otherwise, close immediately. */ + void Close(bool writeblock); + /** This ensures that close is called prior to destructor */ CullResult cull() CXX11_OVERRIDE; |