diff options
author | Mark Salyzyn <salyzyn@google.com> | 2014-01-08 12:44:23 -0800 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2014-01-27 15:22:49 -0800 |
commit | 44b99c22af84331068935a9bc3e807165a88237c (patch) | |
tree | 6f2641e55435a0b47946d323b966543ae08e9061 /include/sysutils | |
parent | 23f04107dcedcef22556c1f57502cdddbfa2663f (diff) | |
download | core-44b99c22af84331068935a9bc3e807165a88237c.tar.gz core-44b99c22af84331068935a9bc3e807165a88237c.tar.bz2 core-44b99c22af84331068935a9bc3e807165a88237c.zip |
libsysutils: SocketListener export release
* Foreground thread (legacy) closes connection by
reporting false return value for onDataAvailable.
* Background thread can choose instead to close the
connection asynchronously by calling release, must
return true for the onDataAvailable method.
(cherry picked from commit d7ad4e409eaac53db3a9789060097b712850b337)
Change-Id: I70ab37d5c22b02804aa3b4dfb26cc9b75291f8b6
Diffstat (limited to 'include/sysutils')
-rw-r--r-- | include/sysutils/SocketListener.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/sysutils/SocketListener.h b/include/sysutils/SocketListener.h index 649c89a0d..c204a0fc3 100644 --- a/include/sysutils/SocketListener.h +++ b/include/sysutils/SocketListener.h @@ -44,10 +44,13 @@ public: void runOnEachSocket(SocketClientCommand *command); + bool release(SocketClient *c) { return release(c, true); } + protected: virtual bool onDataAvailable(SocketClient *c) = 0; private: + bool release(SocketClient *c, bool wakeup); static void *threadStart(void *obj); void runListener(); void init(const char *socketName, int socketFd, bool listen, bool useCmdNum); |