- attempt to improve network performance (use separate mutexes for read / write operations)

This commit is contained in:
Mark Vejvoda
2011-02-15 07:49:40 +00:00
parent 2357e2cfd1
commit 8ec58868dc
4 changed files with 80 additions and 95 deletions

View File

@@ -100,7 +100,8 @@ public:
};
#endif
class Socket : public SimpleTaskCallbackInterface {
//class Socket : public SimpleTaskCallbackInterface {
class Socket {
protected:
#ifdef WIN32
@@ -112,19 +113,20 @@ protected:
std::string ipAddress;
std::string connectedIpAddress;
SimpleTaskThread *pingThread;
//SimpleTaskThread *pingThread;
std::map<string,double> pingCache;
time_t lastThreadedPing;
Mutex pingThreadAccessor;
Mutex dataSynchAccessor;
Mutex dataSynchAccessorRead;
Mutex dataSynchAccessorWrite;
public:
Socket(PLATFORM_SOCKET sock);
Socket();
virtual ~Socket();
virtual void simpleTask(BaseThread *callingThread);
//virtual void simpleTask(BaseThread *callingThread);
static int getBroadCastPort() { return broadcast_portno; }
static void setBroadCastPort(int value) { broadcast_portno = value; }
@@ -147,7 +149,7 @@ public:
static void setBlock(bool block, PLATFORM_SOCKET socket);
bool isReadable();
bool isWritable(bool waitOnDelayedResponse);
bool isWritable();
bool isConnected();
static string getHostName();