diff options
author | Drew Richardson <drew.richardson@arm.com> | 2011-11-29 12:00:00 -0800 |
---|---|---|
committer | Drew Richardson <drew.richardson@arm.com> | 2014-12-19 15:22:16 -0800 |
commit | 689b7539711ab098911503808cc3e24307d9bcf7 (patch) | |
tree | eded88dc8c354b94a0b930d3c44f9da2348a4ace /daemon/Sender.cpp | |
parent | 24395bff3db9e12e6f406ad783ecc9bcde626253 (diff) |
gator: Version 5.85.8
Signed-off-by: Drew Richardson <drew.richardson@arm.com>
Diffstat (limited to 'daemon/Sender.cpp')
-rw-r--r-- | daemon/Sender.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/daemon/Sender.cpp b/daemon/Sender.cpp index 547d425..c547d67 100644 --- a/daemon/Sender.cpp +++ b/daemon/Sender.cpp @@ -6,7 +6,6 @@ * published by the Free Software Foundation. */ -typedef unsigned long long uint64_t; #include <string.h> #include <sys/socket.h> #include <netinet/in.h> @@ -22,6 +21,7 @@ extern void handleException(); Sender::Sender(OlySocket* socket) { dataFile = NULL; + dataSocket = NULL; // Set up the socket connection if (socket) { @@ -44,6 +44,8 @@ Sender::Sender(OlySocket* socket) { gSessionData.mWaitingOnCommand = true; logg->logMessage("Completed magic sequence"); } + + pthread_mutex_init(&sendMutex, NULL); } Sender::~Sender() { @@ -72,10 +74,13 @@ void Sender::writeData(const char* data, int length, int type) { return; } + // Multiple threads call writeData() + pthread_mutex_lock(&sendMutex); + // Send data over the socket connection if (dataSocket) { // Start alarm - alarm(5); + alarm(8); // Send data over the socket, sending the type and size first logg->logMessage("Sending data with length %d", length); @@ -96,4 +101,6 @@ void Sender::writeData(const char* data, int length, int type) { handleException(); } } + + pthread_mutex_unlock(&sendMutex); } |