aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/net/ISocketMultiplexerJob.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/net/ISocketMultiplexerJob.h')
-rw-r--r--src/lib/net/ISocketMultiplexerJob.h31
1 files changed, 22 insertions, 9 deletions
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 <memory>
+
+class ISocketMultiplexerJob;
+
+struct MultiplexerJobStatus
+{
+ MultiplexerJobStatus(bool cont, std::unique_ptr<ISocketMultiplexerJob>&& nj) :
+ continue_servicing(cont), new_job(std::move(nj))
+ {}
+
+ bool continue_servicing = false;
+ std::unique_ptr<ISocketMultiplexerJob> 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; }
//@}
};