From dff8b887edf10407f22aaab9d147948cd5491f0a Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 5 Oct 2019 21:10:01 -0400 Subject: New upstream version 2.3.2+dfsg --- src/lib/net/ISocketMultiplexerJob.h | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'src/lib/net/ISocketMultiplexerJob.h') diff --git a/src/lib/net/ISocketMultiplexerJob.h b/src/lib/net/ISocketMultiplexerJob.h index ddd3ba5..c27fce2 100644 --- a/src/lib/net/ISocketMultiplexerJob.h +++ b/src/lib/net/ISocketMultiplexerJob.h @@ -20,6 +20,19 @@ #include "arch/IArchNetwork.h" #include "common/IInterface.h" +#include + +class ISocketMultiplexerJob; + +struct MultiplexerJobStatus +{ + MultiplexerJobStatus(bool cont, std::unique_ptr&& nj) : + continue_servicing(cont), new_job(std::move(nj)) + {} + + bool continue_servicing = false; + std::unique_ptr new_job; +}; //! Socket multiplexer job /*! @@ -32,21 +45,20 @@ public: //! Handle socket event /*! - Called by a socket multiplexer when the socket becomes readable, - writable, or has an error. It should return itself if the same - job can continue to service events, a new job if the socket must - be serviced differently, or NULL if the socket should no longer - be serviced. The socket is readable if \p readable is true, - writable if \p writable is true, and in error if \p error is - true. + Called by a socket multiplexer when the socket becomes readable, writable, or has an error. + The socket is readable if \p readable is true, writable if \p writable is true, and in error + if \p error is true. + + The method returns false as the continue_servicing member of the returned struct if the socket + should no longer be served and true otherwise. Additionally, if the new_job member of the + returned pair is not empty, the socket should be serviced differently with the specified job. This call must not attempt to directly change the job for this socket by calling \c addSocket() or \c removeSocket() on the multiplexer. It must instead return the new job. It can, however, add or remove jobs for other sockets. */ - virtual ISocketMultiplexerJob* - run(bool readable, bool writable, bool error) = 0; + virtual MultiplexerJobStatus run(bool readable, bool writable, bool error) = 0; //@} //! @name accessors @@ -72,5 +84,6 @@ public: */ virtual bool isWritable() const = 0; + virtual bool isCursor() const { return false; } //@} }; -- cgit v1.2.3