From 5f387071d339892ebed5accba92f91f997396476 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sun, 21 Jul 2019 16:56:55 +0100 Subject: Add a method for swapping user I/O handlers. --- include/inspsocket.h | 7 +++++++ include/socketengine.h | 6 ++++++ include/users.h | 5 +++++ 3 files changed, 18 insertions(+) (limited to 'include') diff --git a/include/inspsocket.h b/include/inspsocket.h index a07c2eb6f..208644645 100644 --- a/include/inspsocket.h +++ b/include/inspsocket.h @@ -275,7 +275,14 @@ class CoreExport StreamSocket : public EventHandler int HookChainRead(IOHook* hook, std::string& rq); protected: + /** The data which has been received from the socket. */ std::string recvq; + + /** Swaps the internals of this StreamSocket with another one. + * @param other A StreamSocket to swap internals with. + */ + void SwapInternals(StreamSocket& other); + public: const Type type; StreamSocket(Type sstype = SS_UNKNOWN) diff --git a/include/socketengine.h b/include/socketengine.h index d8d127f8b..9202c179d 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -164,6 +164,12 @@ class CoreExport EventHandler : public classbase * registered with the SocketEngine */ int fd; + + /** Swaps the internals of this EventHandler with another one. + * @param other A EventHandler to swap internals with. + */ + void SwapInternals(EventHandler& other); + public: /** Get the current file descriptor * @return The file descriptor of this handler diff --git a/include/users.h b/include/users.h index dc7da40fe..94a8af9a4 100644 --- a/include/users.h +++ b/include/users.h @@ -700,6 +700,11 @@ class CoreExport UserIOHandler : public StreamSocket * @param data The data to add to the write buffer */ void AddWriteBuf(const std::string &data); + + /** Swaps the internals of this UserIOHandler with another one. + * @param other A UserIOHandler to swap internals with. + */ + void SwapInternals(UserIOHandler& other); }; typedef unsigned int already_sent_t; -- cgit v1.2.3