summaryrefslogtreecommitdiffstats
path: root/include/sysutils/SocketListener.h
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2012-02-07 12:23:14 -0800
committerRobert Greenwalt <rgreenwalt@google.com>2012-03-05 11:44:43 -0800
commit8702bb17f40022e970e8acd40b348d074e39afc7 (patch)
tree5b8f27e686d6d2b7850129c3d59f435103c482b2 /include/sysutils/SocketListener.h
parentca3bf25570c197757f75b749cddecfea88cbcdc1 (diff)
downloadsystem_core-8702bb17f40022e970e8acd40b348d074e39afc7.zip
system_core-8702bb17f40022e970e8acd40b348d074e39afc7.tar.gz
system_core-8702bb17f40022e970e8acd40b348d074e39afc7.tar.bz2
New NativeDaemonConnector protocol adds a seqnum.
Allows for one socket to be multiplexed for multiple requests. Doesn't use command sequence numbers for broadcasts - would make no sense. Doesn't alter current default behavior so OEM's using these classes won't notice a difference. bug:5864209 Change-Id: Ie3b19c4f81eea868569229a365c8cb7de249c2dd
Diffstat (limited to 'include/sysutils/SocketListener.h')
-rw-r--r--include/sysutils/SocketListener.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/sysutils/SocketListener.h b/include/sysutils/SocketListener.h
index 6592b01..8f56230 100644
--- a/include/sysutils/SocketListener.h
+++ b/include/sysutils/SocketListener.h
@@ -21,16 +21,18 @@
#include <sysutils/SocketClient.h>
class SocketListener {
- int mSock;
+ bool mListen;
const char *mSocketName;
+ int mSock;
SocketClientCollection *mClients;
pthread_mutex_t mClientsLock;
- bool mListen;
int mCtrlPipe[2];
pthread_t mThread;
+ bool mUseCmdNum;
public:
SocketListener(const char *socketName, bool listen);
+ SocketListener(const char *socketName, bool listen, bool useCmdNum);
SocketListener(int socketFd, bool listen);
virtual ~SocketListener();
@@ -38,7 +40,6 @@ public:
int stopListener();
void sendBroadcast(int code, const char *msg, bool addErrno);
- void sendBroadcast(const char *msg);
protected:
virtual bool onDataAvailable(SocketClient *c) = 0;
@@ -46,5 +47,6 @@ protected:
private:
static void *threadStart(void *obj);
void runListener();
+ void init(const char *socketName, int socketFd, bool listen, bool useCmdNum);
};
#endif