numerous important bugfixes:

- observers and end game fog of war enable would most likely cause out of synch, I think its fixed now
- better handling of threaded logging
- cleanup of socket thread processing to ensure all network packets get processed properly and in order
This commit is contained in:
Mark Vejvoda
2010-12-24 08:43:09 +00:00
parent 2a4c9a99cd
commit 03eaa2c033
12 changed files with 165 additions and 287 deletions

View File

@@ -198,7 +198,6 @@ LogFileThread::LogFileThread() : BaseThread() {
void LogFileThread::addLogEntry(SystemFlags::DebugType type, string logEntry) {
MutexSafeWrapper safeMutex(&mutexLogList);
//logList[type].push_back(make_pair(entry,time(NULL)));
LogFileEntry entry;
entry.type = type;
entry.entry = logEntry;
@@ -218,7 +217,7 @@ void LogFileThread::execute() {
try {
for(;this->getQuitStatus() == false;) {
if(difftime(time(NULL),lastSaveToDisk) >= 5) {
if(difftime(time(NULL),lastSaveToDisk) >= 3) {
lastSaveToDisk = time(NULL);
saveToDisk();
}
@@ -247,14 +246,24 @@ void LogFileThread::execute() {
void LogFileThread::saveToDisk() {
MutexSafeWrapper safeMutex(&mutexLogList);
if(logList.size() > 0) {
for(int i = 0; i <logList.size(); ++i) {
LogFileEntry &entry = logList[i];
unsigned int logCount = logList.size();
if(logCount > 0) {
vector<LogFileEntry> tempLogList = logList;
safeMutex.ReleaseLock(true);
logCount = tempLogList.size();
for(int i = 0; i < logCount; ++i) {
LogFileEntry &entry = tempLogList[i];
SystemFlags::logDebugEntry(entry.type, entry.entry, entry.entryDateTime);
}
logList.clear();
safeMutex.Lock();
logList.erase(logList.begin(),logList.begin() + logCount);
safeMutex.ReleaseLock();
}
else {
safeMutex.ReleaseLock();
}
safeMutex.ReleaseLock();
}
}}//end namespace

View File

@@ -1035,7 +1035,7 @@ int Socket::send(const void *data, int dataSize) {
attemptCount++;
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount);
sleep(0);
//sleep(0);
//if(Socket::isWritable(true) == true) {
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);
#ifdef __APPLE__
@@ -1063,7 +1063,7 @@ int Socket::send(const void *data, int dataSize) {
attemptCount++;
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, totalBytesSent = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,totalBytesSent);
sleep(0);
//sleep(0);
//if(bytesSent > 0 || Socket::isWritable(true) == true) {
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);