net/Socket.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
New commits: commit b2583550393ec0ad44636d0ae27b89495b36b24e Author: Ashod Nakashian <[email protected]> Date: Mon Mar 13 21:59:50 2017 -0400 wsd: StreamSocket supports changing its SocketHandler Change-Id: I2ffc33daad4da5b98183af39e3c2a64e7e10b3e8 Reviewed-on: https://gerrit.libreoffice.org/35158 Reviewed-by: Ashod Nakashian <[email protected]> Tested-by: Ashod Nakashian <[email protected]> diff --git a/net/Socket.hpp b/net/Socket.hpp index 75d92ee..a5405a8 100644 --- a/net/Socket.hpp +++ b/net/Socket.hpp @@ -513,7 +513,7 @@ public: }; /// A plain, non-blocking, data streaming socket. -class StreamSocket : public Socket +class StreamSocket : public Socket, public std::enable_shared_from_this<StreamSocket> { public: /// Create a StreamSocket from native FD and take ownership of handler instance. @@ -625,6 +625,13 @@ public: return len != 0; // zero is eof / clean socket close. } + /// Replace the existing SocketHandler with a new one. + void setHandler(std::unique_ptr<SocketHandlerInterface> handler) + { + _socketHandler = std::move(handler); + _socketHandler->onConnect(shared_from_this()); + } + /// Create a socket of type TSocket given an FD and a handler. /// We need this helper since the handler needs a shared_ptr to the socket /// but we can't have a shared_ptr in the ctor. _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
