mirror of
https://github.com/glest/glest-source.git
synced 2025-08-18 14:11:15 +02:00
- try to improve network perf
This commit is contained in:
@@ -1702,7 +1702,7 @@ void Socket::setBlock(bool block, PLATFORM_SOCKET socket) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Socket::isReadable(bool lockMutex) {
|
inline bool Socket::isReadable(bool lockMutex) {
|
||||||
if(isSocketValid() == false) return false;
|
if(isSocketValid() == false) return false;
|
||||||
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@@ -1712,10 +1712,11 @@ bool Socket::isReadable(bool lockMutex) {
|
|||||||
fd_set set;
|
fd_set set;
|
||||||
FD_ZERO(&set);
|
FD_ZERO(&set);
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex(NULL,CODE_AT_LINE);
|
Mutex *lockMutexObj = (lockMutex == true ? dataSynchAccessorRead : NULL);
|
||||||
if(lockMutex == true) {
|
MutexSafeWrapper safeMutex(lockMutexObj,CODE_AT_LINE);
|
||||||
safeMutex.setMutex(dataSynchAccessorRead,CODE_AT_LINE);
|
//if(lockMutex == true) {
|
||||||
}
|
// safeMutex.setMutex(dataSynchAccessorRead,CODE_AT_LINE);
|
||||||
|
//}
|
||||||
FD_SET(sock, &set);
|
FD_SET(sock, &set);
|
||||||
int i = select((int)sock + 1, &set, NULL, NULL, &tv);
|
int i = select((int)sock + 1, &set, NULL, NULL, &tv);
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
@@ -1732,7 +1733,7 @@ bool Socket::isReadable(bool lockMutex) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Socket::isWritable(struct timeval *timeVal, bool lockMutex) {
|
inline bool Socket::isWritable(struct timeval *timeVal, bool lockMutex) {
|
||||||
if(isSocketValid() == false) return false;
|
if(isSocketValid() == false) return false;
|
||||||
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
@@ -1747,10 +1748,12 @@ bool Socket::isWritable(struct timeval *timeVal, bool lockMutex) {
|
|||||||
fd_set set;
|
fd_set set;
|
||||||
FD_ZERO(&set);
|
FD_ZERO(&set);
|
||||||
|
|
||||||
MutexSafeWrapper safeMutex(NULL,CODE_AT_LINE);
|
Mutex *lockMutexObj = (lockMutex == true ? dataSynchAccessorWrite : NULL);
|
||||||
if(lockMutex == true) {
|
MutexSafeWrapper safeMutex(lockMutexObj,CODE_AT_LINE);
|
||||||
safeMutex.setMutex(dataSynchAccessorWrite,CODE_AT_LINE);
|
// MutexSafeWrapper safeMutex(NULL,CODE_AT_LINE);
|
||||||
}
|
// if(lockMutex == true) {
|
||||||
|
// safeMutex.setMutex(dataSynchAccessorWrite,CODE_AT_LINE);
|
||||||
|
// }
|
||||||
FD_SET(sock, &set);
|
FD_SET(sock, &set);
|
||||||
int i = select((int)sock + 1, NULL, &set, NULL, &tv);
|
int i = select((int)sock + 1, NULL, &set, NULL, &tv);
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
Reference in New Issue
Block a user