mirror of
https://github.com/glest/glest-source.git
synced 2025-08-22 16:02:50 +02:00
- attempt better socket disconnect checking
This commit is contained in:
@@ -1571,6 +1571,7 @@ int Socket::peek(void *data, int dataSize,bool mustGetData,int *pLastSocketError
|
|||||||
|
|
||||||
//printf("Peek #2 err = %d\n",err);
|
//printf("Peek #2 err = %d\n",err);
|
||||||
|
|
||||||
|
Chrono chronoElapsed(true);
|
||||||
const int MAX_PEEK_WAIT_SECONDS = 3;
|
const int MAX_PEEK_WAIT_SECONDS = 3;
|
||||||
time_t tStartTimer = time(NULL);
|
time_t tStartTimer = time(NULL);
|
||||||
while((err < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) &&
|
while((err < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||||
@@ -1583,7 +1584,7 @@ int Socket::peek(void *data, int dataSize,bool mustGetData,int *pLastSocketError
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if(Socket::isReadable(true) == true) {
|
if(Socket::isReadable(true) == true || chronoElapsed.getMillis() % 100 == 0) {
|
||||||
|
|
||||||
// MutexSafeWrapper safeMutexSocketDestructorFlag(&inSocketDestructorSynchAccessor,CODE_AT_LINE);
|
// MutexSafeWrapper safeMutexSocketDestructorFlag(&inSocketDestructorSynchAccessor,CODE_AT_LINE);
|
||||||
// if(this->inSocketDestructor == true) {
|
// if(this->inSocketDestructor == true) {
|
||||||
@@ -1614,7 +1615,7 @@ int Socket::peek(void *data, int dataSize,bool mustGetData,int *pLastSocketError
|
|||||||
|
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
|
|
||||||
if(err <= 0) {
|
if(err == 0 || err == PLATFORM_SOCKET_TRY_AGAIN) {
|
||||||
sleep(0);
|
sleep(0);
|
||||||
}
|
}
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) if(chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) if(chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||||
|
Reference in New Issue
Block a user