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
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 @@
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 @@
private:
static void *threadStart(void *obj);
void runListener();
+ void init(const char *socketName, int socketFd, bool listen, bool useCmdNum);
};
#endif