X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Finspsocket.h;h=a07c2eb6f82c2aaf4519496fa7dadee80b69e560;hb=9b35c4c78cb15bdae0431f1425983bc41150fee5;hp=a41c3ebc733e666c08ccdf0c4c873c88c99b5236;hpb=87b1461e2a4710a38b32186c2582da9fe9bb3804;p=user%2Fhenk%2Fcode%2Finspircd.git 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;