- a bold attempt to push the socket read threads to read continuously to see if this is:
a) stable without causing out of synch b) not too hard on the CPU
This commit is contained in:
parent
2a8c712b1a
commit
4e882796a1
|
@ -471,10 +471,13 @@ void ChatManager::updateNetwork() {
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] gameNetworkInterface->getChatText() [%s]\n",__FILE__,__FUNCTION__,__LINE__,gameNetworkInterface->getChatText().c_str());
|
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] gameNetworkInterface->getChatText() [%s]\n",__FILE__,__FUNCTION__,__LINE__,gameNetworkInterface->getChatText().c_str());
|
||||||
|
|
||||||
if(gameNetworkInterface != NULL && gameNetworkInterface->getChatTextList().empty() == false) {
|
if(gameNetworkInterface != NULL &&
|
||||||
|
gameNetworkInterface->getChatTextList(false).empty() == false) {
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
for(int idx = 0; idx < gameNetworkInterface->getChatTextList().size(); idx++) {
|
|
||||||
const ChatMsgInfo &msg = gameNetworkInterface->getChatTextList()[idx];
|
std::vector<ChatMsgInfo> chatList = gameNetworkInterface->getChatTextList(true);
|
||||||
|
for(int idx = 0; idx < chatList.size(); idx++) {
|
||||||
|
const ChatMsgInfo msg = chatList[idx];
|
||||||
int teamIndex= msg.chatTeamIndex;
|
int teamIndex= msg.chatTeamIndex;
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] got nmtText [%s] for team = %d\n",__FILE__,__FUNCTION__,msg.chatText.c_str(),teamIndex);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] got nmtText [%s] for team = %d\n",__FILE__,__FUNCTION__,msg.chatText.c_str(),teamIndex);
|
||||||
|
@ -491,7 +494,7 @@ void ChatManager::updateNetwork() {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
}
|
}
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
gameNetworkInterface->clearChatInfo();
|
//gameNetworkInterface->clearChatInfo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const std::exception &ex) {
|
catch(const std::exception &ex) {
|
||||||
|
|
|
@ -3232,10 +3232,10 @@ void Game::showLoseMessageBox() {
|
||||||
|
|
||||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||||
if(networkManager.isNetworkGame() == true && networkManager.getNetworkRole() == nrServer) {
|
if(networkManager.isNetworkGame() == true && networkManager.getNetworkRole() == nrServer) {
|
||||||
showMessageBox(lang.get("YouLose")+", "+lang.get("ExitGameServer?"), lang.get("BattleOver"), false);
|
showMessageBox(lang.get("YouLose")+" "+lang.get("ExitGameServer?"), lang.get("BattleOver"), false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showMessageBox(lang.get("YouLose")+", "+lang.get("ExitGame?"), lang.get("BattleOver"), false);
|
showMessageBox(lang.get("YouLose")+" "+lang.get("ExitGame?"), lang.get("BattleOver"), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3243,10 +3243,10 @@ void Game::showWinMessageBox() {
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
|
|
||||||
if(this->masterserverMode == true || world.getThisFaction()->getType()->getPersonalityType() == fpt_Observer) {
|
if(this->masterserverMode == true || world.getThisFaction()->getType()->getPersonalityType() == fpt_Observer) {
|
||||||
showMessageBox(lang.get("GameOver")+", "+lang.get("ExitGame?"), lang.get("BattleOver"), false);
|
showMessageBox(lang.get("GameOver")+" "+lang.get("ExitGame?"), lang.get("BattleOver"), false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showMessageBox(lang.get("YouWin")+", "+lang.get("ExitGame?"), lang.get("BattleOver"), false);
|
showMessageBox(lang.get("YouWin")+" "+lang.get("ExitGame?"), lang.get("BattleOver"), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,16 +32,18 @@ namespace Glest{ namespace Game{
|
||||||
// class ConnectionSlotThread
|
// class ConnectionSlotThread
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
ConnectionSlotThread::ConnectionSlotThread(int slotIndex) : BaseThread() {
|
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlot *slot) : BaseThread() {
|
||||||
this->slotIndex = slotIndex;
|
this->slot = slot;
|
||||||
|
this->slotIndex = this->slot->getPlayerIndex();
|
||||||
this->slotInterface = NULL;
|
this->slotInterface = NULL;
|
||||||
//this->event = NULL;
|
//this->event = NULL;
|
||||||
eventList.clear();
|
eventList.clear();
|
||||||
eventList.reserve(100);
|
eventList.reserve(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex) : BaseThread() {
|
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,ConnectionSlot *slot) : BaseThread() {
|
||||||
this->slotIndex = slotIndex;
|
this->slot = slot;
|
||||||
|
this->slotIndex = this->slot->getPlayerIndex();
|
||||||
this->slotInterface = slotInterface;
|
this->slotInterface = slotInterface;
|
||||||
//this->event = NULL;
|
//this->event = NULL;
|
||||||
eventList.clear();
|
eventList.clear();
|
||||||
|
@ -163,6 +165,9 @@ void ConnectionSlotThread::execute() {
|
||||||
//setRunningStatus(true);
|
//setRunningStatus(true);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
Chrono chrono;
|
||||||
|
chrono.start();
|
||||||
|
|
||||||
//unsigned int idx = 0;
|
//unsigned int idx = 0;
|
||||||
for(;this->slotInterface != NULL;) {
|
for(;this->slotInterface != NULL;) {
|
||||||
if(getQuitStatus() == true) {
|
if(getQuitStatus() == true) {
|
||||||
|
@ -170,13 +175,14 @@ void ConnectionSlotThread::execute() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
semTaskSignalled.waitTillSignalled();
|
//semTaskSignalled.waitTillSignalled();
|
||||||
|
|
||||||
if(getQuitStatus() == true) {
|
//if(getQuitStatus() == true) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
// if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
break;
|
// break;
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
/*
|
||||||
MutexSafeWrapper safeMutex(&triggerIdMutex,CODE_AT_LINE);
|
MutexSafeWrapper safeMutex(&triggerIdMutex,CODE_AT_LINE);
|
||||||
int eventCount = eventList.size();
|
int eventCount = eventList.size();
|
||||||
if(eventCount > 0) {
|
if(eventCount > 0) {
|
||||||
|
@ -208,11 +214,24 @@ void ConnectionSlotThread::execute() {
|
||||||
else {
|
else {
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if(this->slot != NULL) {
|
||||||
|
ConnectionSlotEvent event;
|
||||||
|
event.triggerId = this->slotIndex;
|
||||||
|
event.socketTriggered = true;
|
||||||
|
|
||||||
|
ExecutingTaskSafeWrapper safeExecutingTaskMutex(this);
|
||||||
|
this->slot->updateSlot(&event);
|
||||||
|
}
|
||||||
|
|
||||||
if(getQuitStatus() == true) {
|
if(getQuitStatus() == true) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(chrono.getMillis() % 300 == 0) {
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
@ -250,7 +269,8 @@ ConnectionSlot::ConnectionSlot(ServerInterface* serverInterface, int playerIndex
|
||||||
|
|
||||||
this->setSocket(NULL);
|
this->setSocket(NULL);
|
||||||
this->slotThreadWorker = NULL;
|
this->slotThreadWorker = NULL;
|
||||||
this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface,playerIndex);
|
//this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface,playerIndex);
|
||||||
|
this->slotThreadWorker = new ConnectionSlotThread(this->serverInterface,this);
|
||||||
this->slotThreadWorker->setUniqueID(__FILE__);
|
this->slotThreadWorker->setUniqueID(__FILE__);
|
||||||
this->slotThreadWorker->start();
|
this->slotThreadWorker->start();
|
||||||
|
|
||||||
|
@ -290,19 +310,19 @@ void ConnectionSlot::updateSlot(ConnectionSlotEvent *event) {
|
||||||
Chrono chrono;
|
Chrono chrono;
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
|
||||||
|
|
||||||
if(event != NULL) {
|
//if(event != NULL) {
|
||||||
bool &socketTriggered = event->socketTriggered;
|
//bool &socketTriggered = event->socketTriggered;
|
||||||
bool checkForNewClients = (serverInterface->getGameHasBeenInitiated() == false);
|
bool checkForNewClients = (serverInterface->getGameHasBeenInitiated() == false);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] MUTEX LOCK held for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] MUTEX LOCK held for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||||
|
|
||||||
if((serverInterface->getGameHasBeenInitiated() == false ||
|
//if((serverInterface->getGameHasBeenInitiated() == false ||
|
||||||
//(this->getSocket() != NULL && socketTriggered == true))) {
|
//(this->getSocket() != NULL && socketTriggered == true))) {
|
||||||
socketTriggered == true)) {
|
// socketTriggered == true)) {
|
||||||
if(socketTriggered == true ||
|
// if(socketTriggered == true ||
|
||||||
(serverInterface->getGameHasBeenInitiated() == false && this->isConnected() == false)) {
|
// (serverInterface->getGameHasBeenInitiated() == false && this->isConnected() == false)) {
|
||||||
|
|
||||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] MUTEX LOCK held for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] MUTEX LOCK held for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||||
|
|
||||||
|
@ -316,10 +336,10 @@ void ConnectionSlot::updateSlot(ConnectionSlotEvent *event) {
|
||||||
//if(this->getSocket() == NULL) {
|
//if(this->getSocket() == NULL) {
|
||||||
// checkForNewClients = false;
|
// checkForNewClients = false;
|
||||||
//}
|
//}
|
||||||
}
|
//}
|
||||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] MUTEX LOCK held for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] MUTEX LOCK held for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||||
}
|
//}
|
||||||
}
|
//}
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
|
@ -330,9 +350,9 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||||
try {
|
try {
|
||||||
clearThreadErrorList();
|
clearThreadErrorList();
|
||||||
|
|
||||||
if(slotThreadWorker != NULL) {
|
//if(slotThreadWorker != NULL) {
|
||||||
slotThreadWorker->purgeCompletedEvents();
|
// slotThreadWorker->purgeCompletedEvents();
|
||||||
}
|
//}
|
||||||
|
|
||||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||||
|
|
||||||
|
@ -464,7 +484,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||||
|
|
||||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||||
|
|
||||||
this->clearChatInfo();
|
//this->clearChatInfo();
|
||||||
|
|
||||||
bool gotTextMsg = true;
|
bool gotTextMsg = true;
|
||||||
for(;this->hasDataToRead() == true && gotTextMsg == true;) {
|
for(;this->hasDataToRead() == true && gotTextMsg == true;) {
|
||||||
|
|
|
@ -78,6 +78,7 @@ protected:
|
||||||
Mutex triggerIdMutex;
|
Mutex triggerIdMutex;
|
||||||
vector<ConnectionSlotEvent> eventList;
|
vector<ConnectionSlotEvent> eventList;
|
||||||
int slotIndex;
|
int slotIndex;
|
||||||
|
ConnectionSlot *slot;
|
||||||
|
|
||||||
virtual void setQuitStatus(bool value);
|
virtual void setQuitStatus(bool value);
|
||||||
virtual void setTaskCompleted(int eventId);
|
virtual void setTaskCompleted(int eventId);
|
||||||
|
@ -86,8 +87,8 @@ protected:
|
||||||
void slotUpdateTask(ConnectionSlotEvent *event);
|
void slotUpdateTask(ConnectionSlotEvent *event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConnectionSlotThread(int slotIndex);
|
ConnectionSlotThread(ConnectionSlot *slot);
|
||||||
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex);
|
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,ConnectionSlot *slot);
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
void signalUpdate(ConnectionSlotEvent *event);
|
void signalUpdate(ConnectionSlotEvent *event);
|
||||||
bool isSignalCompleted(ConnectionSlotEvent *event);
|
bool isSignalCompleted(ConnectionSlotEvent *event);
|
||||||
|
|
|
@ -108,7 +108,24 @@ void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<ChatMsgInfo> NetworkInterface::getChatTextList(bool clearAfterRetrieve) {
|
||||||
|
std::vector<ChatMsgInfo> result;
|
||||||
|
MutexSafeWrapper safeMutex(&mutexChatTextList,CODE_AT_LINE);
|
||||||
|
result = chatTextList;
|
||||||
|
if(clearAfterRetrieve == true) {
|
||||||
|
chatTextList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkInterface::addChatInfo(const ChatMsgInfo &msg) {
|
||||||
|
MutexSafeWrapper safeMutex(&mutexChatTextList,CODE_AT_LINE);
|
||||||
|
chatTextList.push_back(msg);
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkInterface::clearChatInfo() {
|
void NetworkInterface::clearChatInfo() {
|
||||||
|
MutexSafeWrapper safeMutex(&mutexChatTextList,CODE_AT_LINE);
|
||||||
if(chatTextList.empty() == false) {
|
if(chatTextList.empty() == false) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] chatTextList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,chatTextList.size());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] chatTextList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,chatTextList.size());
|
||||||
chatTextList.clear();
|
chatTextList.clear();
|
||||||
|
|
|
@ -93,6 +93,7 @@ protected:
|
||||||
string networkGameDataSynchCheckTechMismatchReport;
|
string networkGameDataSynchCheckTechMismatchReport;
|
||||||
bool receivedDataSynchCheck;
|
bool receivedDataSynchCheck;
|
||||||
|
|
||||||
|
Mutex mutexChatTextList;
|
||||||
std::vector<ChatMsgInfo> chatTextList;
|
std::vector<ChatMsgInfo> chatTextList;
|
||||||
NetworkMessagePing lastPingInfo;
|
NetworkMessagePing lastPingInfo;
|
||||||
|
|
||||||
|
@ -141,9 +142,9 @@ public:
|
||||||
virtual bool getNetworkGameDataSynchCheckOkTile() { return networkGameDataSynchCheckOkTile; }
|
virtual bool getNetworkGameDataSynchCheckOkTile() { return networkGameDataSynchCheckOkTile; }
|
||||||
virtual bool getNetworkGameDataSynchCheckOkTech() { return networkGameDataSynchCheckOkTech; }
|
virtual bool getNetworkGameDataSynchCheckOkTech() { return networkGameDataSynchCheckOkTech; }
|
||||||
|
|
||||||
const std::vector<ChatMsgInfo> & getChatTextList() const { return chatTextList; }
|
std::vector<ChatMsgInfo> getChatTextList(bool clearAfterRetrieve);
|
||||||
void clearChatInfo();
|
void clearChatInfo();
|
||||||
void addChatInfo(const ChatMsgInfo &msg) { chatTextList.push_back(msg); }
|
void addChatInfo(const ChatMsgInfo &msg);
|
||||||
|
|
||||||
virtual bool getConnectHasHandshaked() const= 0;
|
virtual bool getConnectHasHandshaked() const= 0;
|
||||||
|
|
||||||
|
|
|
@ -882,6 +882,110 @@ void ServerInterface::checkForLaggingClients(std::map<int,bool> &mapSlotSignalle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerInterface::checkForLaggingClients(std::vector <string> &errorMsgList) {
|
||||||
|
bool lastGlobalLagCheckTimeUpdate = false;
|
||||||
|
time_t waitForClientsElapsed = time(NULL);
|
||||||
|
time_t waitForThreadElapsed = time(NULL);
|
||||||
|
std::map<int,bool> slotsWarnedList;
|
||||||
|
// Examine all threads for completion of delegation
|
||||||
|
for(int i= 0; exitServer == false && i < GameConstants::maxPlayers; ++i) {
|
||||||
|
MutexSafeWrapper safeMutexSlot(&slotAccessorMutexes[i],CODE_AT_LINE_X(i));
|
||||||
|
ConnectionSlot* connectionSlot = slots[i];
|
||||||
|
if(connectionSlot != NULL) {
|
||||||
|
try {
|
||||||
|
std::vector<std::string> errorList = connectionSlot->getThreadErrorList();
|
||||||
|
// Show any collected errors from threads
|
||||||
|
if(errorList.empty() == false) {
|
||||||
|
for(int iErrIdx = 0; iErrIdx < errorList.size(); ++iErrIdx) {
|
||||||
|
string &sErr = errorList[iErrIdx];
|
||||||
|
if(sErr != "") {
|
||||||
|
errorMsgList.push_back(sErr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
connectionSlot->clearThreadErrorList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// New lag check
|
||||||
|
std::pair<bool,bool> clientLagExceededOrWarned = std::make_pair(false,false);
|
||||||
|
if( gameHasBeenInitiated == true &&
|
||||||
|
connectionSlot->isConnected() == true) {
|
||||||
|
clientLagExceededOrWarned = clientLagCheck(connectionSlot,slotsWarnedList[i]);
|
||||||
|
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] clientLagExceededOrWarned.first = %d, clientLagExceededOrWarned.second = %d, gameSettings.getNetworkPauseGameForLaggedClients() = %d\n",__FILE__,__FUNCTION__,__LINE__,clientLagExceededOrWarned.first,clientLagExceededOrWarned.second,gameSettings.getNetworkPauseGameForLaggedClients());
|
||||||
|
|
||||||
|
if(clientLagExceededOrWarned.first == true) {
|
||||||
|
slotsWarnedList[i] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If the client has exceeded lag and the server wants
|
||||||
|
// to pause while they catch up, re-trigger the
|
||||||
|
// client reader thread
|
||||||
|
// if((clientLagExceededOrWarned.first == true && gameSettings.getNetworkPauseGameForLaggedClients() == true)) { // ||
|
||||||
|
// //(clientLagExceededOrWarned.second == true && slotsWarnedAndRetried[i] == false)) {
|
||||||
|
//
|
||||||
|
// if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d, clientLagExceededOrWarned.first = %d, clientLagExceededOrWarned.second = %d, difftime(time(NULL),waitForClientsElapsed) = %.2f, MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE = %.2f\n",__FILE__,__FUNCTION__,__LINE__,clientLagExceededOrWarned.first,clientLagExceededOrWarned.second,difftime(time(NULL),waitForClientsElapsed),MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE);
|
||||||
|
//
|
||||||
|
// if(difftime(time(NULL),waitForClientsElapsed) < MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE) {
|
||||||
|
// if(connectionSlot != NULL) {
|
||||||
|
// if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d, clientLagExceededOrWarned.first = %d, clientLagExceededOrWarned.second = %d\n",__FILE__,__FUNCTION__,__LINE__,clientLagExceededOrWarned.first,clientLagExceededOrWarned.second);
|
||||||
|
//
|
||||||
|
// bool socketTriggered = false;
|
||||||
|
// PLATFORM_SOCKET clientSocket = connectionSlot->getSocketId();
|
||||||
|
// if(clientSocket > 0) {
|
||||||
|
// socketTriggered = socketTriggeredList[clientSocket];
|
||||||
|
// }
|
||||||
|
// ConnectionSlotEvent &event = eventList[i];
|
||||||
|
// mapSlotSignalledList[i] = signalClientReceiveCommands(connectionSlot,i,socketTriggered,event);
|
||||||
|
// threadsDone = false;
|
||||||
|
// }
|
||||||
|
// if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d, clientLagExceededOrWarned.first = %d, clientLagExceededOrWarned.second = %d\n",__FILE__,__FUNCTION__,__LINE__,clientLagExceededOrWarned.first,clientLagExceededOrWarned.second);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
catch(const exception &ex) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||||
|
errorMsgList.push_back(ex.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(connectionSlot != NULL && connectionSlot->isConnected() == true) {
|
||||||
|
try {
|
||||||
|
if(gameHasBeenInitiated == true &&
|
||||||
|
difftime(time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||||
|
|
||||||
|
//printf("\n\n\n^^^^^^^^^^^^^^ PART A\n\n\n");
|
||||||
|
|
||||||
|
// New lag check
|
||||||
|
std::pair<bool,bool> clientLagExceededOrWarned = std::make_pair(false,false);
|
||||||
|
if( gameHasBeenInitiated == true && connectionSlot != NULL &&
|
||||||
|
connectionSlot->isConnected() == true) {
|
||||||
|
//printf("\n\n\n^^^^^^^^^^^^^^ PART B\n\n\n");
|
||||||
|
|
||||||
|
lastGlobalLagCheckTimeUpdate = true;
|
||||||
|
clientLagExceededOrWarned = clientLagCheck(connectionSlot,slotsWarnedList[i]);
|
||||||
|
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] clientLagExceededOrWarned.first = %d, clientLagExceededOrWarned.second = %d, gameSettings.getNetworkPauseGameForLaggedClients() = %d\n",__FILE__,__FUNCTION__,__LINE__,clientLagExceededOrWarned.first,clientLagExceededOrWarned.second,gameSettings.getNetworkPauseGameForLaggedClients());
|
||||||
|
|
||||||
|
if(clientLagExceededOrWarned.first == true) {
|
||||||
|
slotsWarnedList[i] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(const exception &ex) {
|
||||||
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||||
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] error detected [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||||
|
errorMsgList.push_back(ex.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(lastGlobalLagCheckTimeUpdate == true) {
|
||||||
|
lastGlobalLagCheckTime = time(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ServerInterface::executeNetworkCommandsFromClients() {
|
void ServerInterface::executeNetworkCommandsFromClients() {
|
||||||
if(gameHasBeenInitiated == true) {
|
if(gameHasBeenInitiated == true) {
|
||||||
for(int i= 0; exitServer == false && i < GameConstants::maxPlayers; ++i) {
|
for(int i= 0; exitServer == false && i < GameConstants::maxPlayers; ++i) {
|
||||||
|
@ -905,14 +1009,15 @@ void ServerInterface::dispatchPendingChatMessages(std::vector <string> &errorMsg
|
||||||
MutexSafeWrapper safeMutexSlot(&slotAccessorMutexes[i],CODE_AT_LINE_X(i));
|
MutexSafeWrapper safeMutexSlot(&slotAccessorMutexes[i],CODE_AT_LINE_X(i));
|
||||||
ConnectionSlot* connectionSlot= slots[i];
|
ConnectionSlot* connectionSlot= slots[i];
|
||||||
if(connectionSlot != NULL &&
|
if(connectionSlot != NULL &&
|
||||||
connectionSlot->getChatTextList().empty() == false) {
|
connectionSlot->getChatTextList(false).empty() == false) {
|
||||||
try {
|
try {
|
||||||
|
std::vector<ChatMsgInfo> chatList = connectionSlot->getChatTextList(true);
|
||||||
for(int chatIdx = 0;
|
for(int chatIdx = 0;
|
||||||
exitServer == false && slots[i] != NULL &&
|
exitServer == false &&
|
||||||
chatIdx < connectionSlot->getChatTextList().size(); chatIdx++) {
|
chatIdx < chatList.size(); chatIdx++) {
|
||||||
connectionSlot= slots[i];
|
//connectionSlot= slots[i];
|
||||||
if(connectionSlot != NULL) {
|
//if(connectionSlot != NULL) {
|
||||||
ChatMsgInfo msg(connectionSlot->getChatTextList()[chatIdx]);
|
ChatMsgInfo msg(chatList[chatIdx]);
|
||||||
this->addChatInfo(msg);
|
this->addChatInfo(msg);
|
||||||
|
|
||||||
string newChatText = msg.chatText.c_str();
|
string newChatText = msg.chatText.c_str();
|
||||||
|
@ -928,15 +1033,15 @@ void ServerInterface::dispatchPendingChatMessages(std::vector <string> &errorMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] after broadcast nmtText chatText [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatTeamIndex);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] after broadcast nmtText chatText [%s] chatTeamIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,newChatText.c_str(),newChatTeamIndex);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] i = %d\n",__FILE__,__FUNCTION__,__LINE__,i);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] i = %d\n",__FILE__,__FUNCTION__,__LINE__,i);
|
||||||
// Its possible that the slot is disconnected here
|
// Its possible that the slot is disconnected here
|
||||||
// so check the original pointer again
|
// so check the original pointer again
|
||||||
if(slots[i] != NULL) {
|
//if(slots[i] != NULL) {
|
||||||
slots[i]->clearChatInfo();
|
// slots[i]->clearChatInfo();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
catch(const exception &ex) {
|
catch(const exception &ex) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
|
||||||
|
@ -970,41 +1075,44 @@ void ServerInterface::update() {
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
std::map<PLATFORM_SOCKET,bool> socketTriggeredList;
|
//std::map<PLATFORM_SOCKET,bool> socketTriggeredList;
|
||||||
//update all slots
|
//update all slots
|
||||||
updateSocketTriggeredList(socketTriggeredList);
|
//updateSocketTriggeredList(socketTriggeredList);
|
||||||
|
|
||||||
//printf("\nServerInterface::update -- D\n");
|
//printf("\nServerInterface::update -- D\n");
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
if(gameHasBeenInitiated == false || socketTriggeredList.empty() == false) {
|
//if(gameHasBeenInitiated == false || socketTriggeredList.empty() == false) {
|
||||||
|
{
|
||||||
//printf("\nServerInterface::update -- E\n");
|
//printf("\nServerInterface::update -- E\n");
|
||||||
|
|
||||||
std::map<int,ConnectionSlotEvent> eventList;
|
//std::map<int,ConnectionSlotEvent> eventList;
|
||||||
bool hasData = Socket::hasDataToRead(socketTriggeredList);
|
//bool hasData = Socket::hasDataToRead(socketTriggeredList);
|
||||||
|
|
||||||
if(hasData) if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] hasData == true\n",__FILE__,__FUNCTION__);
|
//if(hasData) if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] hasData == true\n",__FILE__,__FUNCTION__);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
if(gameHasBeenInitiated == false || hasData == true) {
|
//if(gameHasBeenInitiated == false || hasData == true) {
|
||||||
std::map<int,bool> mapSlotSignalledList;
|
{
|
||||||
|
//std::map<int,bool> mapSlotSignalledList;
|
||||||
|
|
||||||
// Step #1 tell all connection slot worker threads to receive socket data
|
// Step #1 tell all connection slot worker threads to receive socket data
|
||||||
signalClientsToRecieveData(socketTriggeredList, eventList, mapSlotSignalledList);
|
//signalClientsToRecieveData(socketTriggeredList, eventList, mapSlotSignalledList);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ============ Step #2\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ============ Step #2\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
// Step #2 check all connection slot worker threads for completed status
|
// Step #2 check all connection slot worker threads for completed status
|
||||||
checkForCompletedClients(mapSlotSignalledList,errorMsgList, eventList);
|
//checkForCompletedClients(mapSlotSignalledList,errorMsgList, eventList);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ============ Step #3\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ============ Step #3\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
// Step #3 check clients for any lagging scenarios and try to deal with them
|
// Step #3 check clients for any lagging scenarios and try to deal with them
|
||||||
checkForLaggingClients(mapSlotSignalledList, eventList, socketTriggeredList,errorMsgList);
|
//checkForLaggingClients(mapSlotSignalledList, eventList, socketTriggeredList,errorMsgList);
|
||||||
|
checkForLaggingClients(errorMsgList);
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ============ Step #4\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ============ Step #4\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
@ -1021,27 +1129,27 @@ void ServerInterface::update() {
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
else if(gameHasBeenInitiated == true &&
|
// else if(gameHasBeenInitiated == true &&
|
||||||
difftime(time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
// difftime(time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||||
//printf("\nServerInterface::update -- E1\n");
|
// //printf("\nServerInterface::update -- E1\n");
|
||||||
|
//
|
||||||
//std::map<int,ConnectionSlotEvent> eventList;
|
// //std::map<int,ConnectionSlotEvent> eventList;
|
||||||
std::map<int,bool> mapSlotSignalledList;
|
// std::map<int,bool> mapSlotSignalledList;
|
||||||
|
//
|
||||||
checkForLaggingClients(mapSlotSignalledList, eventList, socketTriggeredList,errorMsgList);
|
// checkForLaggingClients(mapSlotSignalledList, eventList, socketTriggeredList,errorMsgList);
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
}
|
}
|
||||||
else if(gameHasBeenInitiated == true &&
|
// else if(gameHasBeenInitiated == true &&
|
||||||
difftime(time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
// difftime(time(NULL),lastGlobalLagCheckTime) >= LAG_CHECK_GRACE_PERIOD) {
|
||||||
//printf("\nServerInterface::update -- F\n");
|
// //printf("\nServerInterface::update -- F\n");
|
||||||
|
//
|
||||||
std::map<int,ConnectionSlotEvent> eventList;
|
// std::map<int,ConnectionSlotEvent> eventList;
|
||||||
std::map<int,bool> mapSlotSignalledList;
|
// std::map<int,bool> mapSlotSignalledList;
|
||||||
|
//
|
||||||
checkForLaggingClients(mapSlotSignalledList, eventList, socketTriggeredList,errorMsgList);
|
// checkForLaggingClients(mapSlotSignalledList, eventList, socketTriggeredList,errorMsgList);
|
||||||
}
|
// }
|
||||||
|
|
||||||
//printf("\nServerInterface::update -- G\n");
|
//printf("\nServerInterface::update -- G\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,6 +207,7 @@ protected:
|
||||||
void signalClientsToRecieveData(std::map<PLATFORM_SOCKET,bool> & socketTriggeredList, std::map<int,ConnectionSlotEvent> & eventList, std::map<int,bool> & mapSlotSignalledList);
|
void signalClientsToRecieveData(std::map<PLATFORM_SOCKET,bool> & socketTriggeredList, std::map<int,ConnectionSlotEvent> & eventList, std::map<int,bool> & mapSlotSignalledList);
|
||||||
void checkForCompletedClients(std::map<int,bool> & mapSlotSignalledList,std::vector <string> &errorMsgList,std::map<int,ConnectionSlotEvent> &eventList);
|
void checkForCompletedClients(std::map<int,bool> & mapSlotSignalledList,std::vector <string> &errorMsgList,std::map<int,ConnectionSlotEvent> &eventList);
|
||||||
void checkForLaggingClients(std::map<int,bool> &mapSlotSignalledList, std::map<int,ConnectionSlotEvent> &eventList, std::map<PLATFORM_SOCKET,bool> &socketTriggeredList,std::vector <string> &errorMsgList);
|
void checkForLaggingClients(std::map<int,bool> &mapSlotSignalledList, std::map<int,ConnectionSlotEvent> &eventList, std::map<PLATFORM_SOCKET,bool> &socketTriggeredList,std::vector <string> &errorMsgList);
|
||||||
|
void checkForLaggingClients(std::vector <string> &errorMsgList);
|
||||||
void executeNetworkCommandsFromClients();
|
void executeNetworkCommandsFromClients();
|
||||||
void dispatchPendingChatMessages(std::vector <string> &errorMsgList);
|
void dispatchPendingChatMessages(std::vector <string> &errorMsgList);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user