mirror of
https://github.com/glest/glest-source.git
synced 2025-08-16 13:23:59 +02:00
- updated for better handling of streflop on different platforms
- attempt for bugfix on windows when socket send buffer is continuously full
This commit is contained in:
@@ -595,6 +595,11 @@ std::pair<string,string> getFolderTreeContentsCheckSumCacheKey(vector<string> pa
|
||||
|
||||
pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, int32 &value) {
|
||||
//bool result = false;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d for Cache file [%s]\n",__FILE__,__FUNCTION__,__LINE__,crcCacheFile.c_str());
|
||||
}
|
||||
|
||||
pair<bool,time_t> result = make_pair(false,0);
|
||||
if(fileExists(crcCacheFile) == true) {
|
||||
#ifdef WIN32
|
||||
@@ -615,6 +620,16 @@ pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, int32 &value) {
|
||||
|
||||
result.first = true;
|
||||
value = crcValue;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
|
||||
struct tm *loctime = localtime (&refreshDate);
|
||||
char szBuf1[100]="";
|
||||
strftime(szBuf1,100,"%Y-%m-%d %H:%M:%S",loctime);
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,
|
||||
"=-=-=-=- READ CACHE for Cache file [%s] refreshDate = %ld [%s], crcValue = %d\n",
|
||||
crcCacheFile.c_str(),refreshDate, szBuf1, crcValue);
|
||||
}
|
||||
}
|
||||
else {
|
||||
time_t now = time(NULL);
|
||||
@@ -626,9 +641,23 @@ pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, int32 &value) {
|
||||
char szBuf2[100]="";
|
||||
strftime(szBuf2,100,"%Y-%m-%d %H:%M:%S",loctime);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"=-=-=-=- NEED TO CALCULATE CRC for Cache file [%s] now = %ld [%s], refreshDate = %ld [%s], crcValue = %d\n",crcCacheFile.c_str(),now, szBuf1, refreshDate, szBuf2, crcValue);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,
|
||||
"=-=-=-=- NEED TO CALCULATE CRC for Cache file [%s] now = %ld [%s], refreshDate = %ld [%s], crcValue = %d\n",
|
||||
crcCacheFile.c_str(),now, szBuf1, refreshDate, szBuf2, crcValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"FILE NOT FOUND(1) for Cache file [%s]\n",crcCacheFile.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"FILE NOT FOUND(2) for Cache file [%s]\n",crcCacheFile.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@@ -1227,10 +1227,10 @@ int Socket::send(const void *data, int dataSize) {
|
||||
|
||||
int lastSocketError = getLastSocketError();
|
||||
if(bytesSent < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR WRITING SOCKET DATA, err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesSent,getLastSocketErrorFormattedText(&lastSocketError).c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR WRITING SOCKET DATA, err = %d error = %s dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,bytesSent,getLastSocketErrorFormattedText(&lastSocketError).c_str(),dataSize);
|
||||
}
|
||||
else if(bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN && isConnected() == true) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during send, trying again...\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during send, trying again... dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,dataSize);
|
||||
|
||||
int attemptCount = 0;
|
||||
time_t tStartTimer = time(NULL);
|
||||
@@ -1240,7 +1240,12 @@ int Socket::send(const void *data, int dataSize) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount);
|
||||
|
||||
if(isConnected() == true) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, sock = %d, dataSize = %d, data = %p\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,sock,dataSize,data);
|
||||
struct timeval timeVal;
|
||||
timeVal.tv_sec = 1;
|
||||
timeVal.tv_usec = 0;
|
||||
bool canWrite = isWritable(&timeVal);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, sock = %d, dataSize = %d, data = %p, canWrite = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,sock,dataSize,data,canWrite);
|
||||
|
||||
// MutexSafeWrapper safeMutexSocketDestructorFlag(&inSocketDestructorSynchAccessor,CODE_AT_LINE);
|
||||
// if(this->inSocketDestructor == true) {
|
||||
@@ -1293,7 +1298,12 @@ int Socket::send(const void *data, int dataSize) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, totalBytesSent = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,totalBytesSent);
|
||||
|
||||
if(isConnected() == true) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, sock = %d, dataSize = %d, data = %p\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,sock,dataSize,data);
|
||||
struct timeval timeVal;
|
||||
timeVal.tv_sec = 1;
|
||||
timeVal.tv_usec = 0;
|
||||
bool canWrite = isWritable(&timeVal);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, sock = %d, dataSize = %d, data = %p, canWrite = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,sock,dataSize,data,canWrite);
|
||||
|
||||
// MutexSafeWrapper safeMutexSocketDestructorFlag(&inSocketDestructorSynchAccessor,CODE_AT_LINE);
|
||||
// if(this->inSocketDestructor == true) {
|
||||
@@ -1602,13 +1612,18 @@ bool Socket::isReadable() {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Socket::isWritable() {
|
||||
bool Socket::isWritable(struct timeval *timeVal) {
|
||||
if(isSocketValid() == false) return false;
|
||||
|
||||
struct timeval tv;
|
||||
tv.tv_sec= 0;
|
||||
//tv.tv_usec= 1;
|
||||
tv.tv_usec= 0;
|
||||
if(timeVal != NULL) {
|
||||
tv = *timeVal;
|
||||
}
|
||||
else {
|
||||
tv.tv_sec= 0;
|
||||
//tv.tv_usec= 1;
|
||||
tv.tv_usec= 0;
|
||||
}
|
||||
|
||||
fd_set set;
|
||||
FD_ZERO(&set);
|
||||
|
@@ -445,7 +445,7 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
|
||||
const float lodBias = max(min(0.0f,4.0f),-4.0f);
|
||||
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("\n\n\n\n\n$$$$ In [%s::%s Line: %d] lodBias = %f\n\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,lodBias);
|
||||
#ifdef USE_STREFLOP
|
||||
if (streflop::fabs(lodBias) > 0.01f) {
|
||||
if (streflop::fabs(static_cast<streflop::Simple>(lodBias)) > 0.01f) {
|
||||
#else
|
||||
if (fabs(lodBias) > 0.01f) {
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user