mirror of
https://github.com/glest/glest-source.git
synced 2025-09-29 00:48:58 +02:00
- rollback network changes
This commit is contained in:
@@ -175,7 +175,7 @@ std::string ClientInterface::getServerIpAddress() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ClientInterface::updateLobby() {
|
void ClientInterface::updateLobby() {
|
||||||
NetworkMessageType networkMessageType = getNextMessageType(0);
|
NetworkMessageType networkMessageType = getNextMessageType();
|
||||||
switch(networkMessageType)
|
switch(networkMessageType)
|
||||||
{
|
{
|
||||||
case nmtInvalid:
|
case nmtInvalid:
|
||||||
@@ -725,7 +725,7 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
|
|||||||
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__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
NetworkMessageType networkMessageType = getNextMessageType(0);
|
NetworkMessageType networkMessageType = getNextMessageType();
|
||||||
|
|
||||||
// consume old messages from the lobby
|
// consume old messages from the lobby
|
||||||
bool discarded = shouldDiscardNetworkMessage(networkMessageType);
|
bool discarded = shouldDiscardNetworkMessage(networkMessageType);
|
||||||
@@ -1038,7 +1038,7 @@ NetworkMessageType ClientInterface::waitForMessage()
|
|||||||
NetworkMessageType msg = nmtInvalid;
|
NetworkMessageType msg = nmtInvalid;
|
||||||
//uint64 waitLoopCount = 0;
|
//uint64 waitLoopCount = 0;
|
||||||
while(msg == nmtInvalid) {
|
while(msg == nmtInvalid) {
|
||||||
msg = getNextMessageType(5);
|
msg = getNextMessageType();
|
||||||
if(msg == nmtInvalid) {
|
if(msg == nmtInvalid) {
|
||||||
if(chrono.getMillis() % 250 == 0 && isConnected() == false) {
|
if(chrono.getMillis() % 250 == 0 && isConnected() == false) {
|
||||||
if(quit == false) {
|
if(quit == false) {
|
||||||
|
@@ -32,18 +32,16 @@ namespace Glest{ namespace Game{
|
|||||||
// class ConnectionSlotThread
|
// class ConnectionSlotThread
|
||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlot *slot) : BaseThread() {
|
ConnectionSlotThread::ConnectionSlotThread(int slotIndex) : BaseThread() {
|
||||||
this->slot = slot;
|
this->slotIndex = slotIndex;
|
||||||
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,ConnectionSlot *slot) : BaseThread() {
|
ConnectionSlotThread::ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex) : BaseThread() {
|
||||||
this->slot = slot;
|
this->slotIndex = slotIndex;
|
||||||
this->slotIndex = this->slot->getPlayerIndex();
|
|
||||||
this->slotInterface = slotInterface;
|
this->slotInterface = slotInterface;
|
||||||
//this->event = NULL;
|
//this->event = NULL;
|
||||||
eventList.clear();
|
eventList.clear();
|
||||||
@@ -165,9 +163,6 @@ 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) {
|
||||||
@@ -175,14 +170,13 @@ 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) {
|
||||||
@@ -214,31 +208,11 @@ void ConnectionSlotThread::execute() {
|
|||||||
else {
|
else {
|
||||||
safeMutex.ReleaseLock();
|
safeMutex.ReleaseLock();
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
bool slotconnected = false;
|
|
||||||
//if(this->slot != NULL) {
|
|
||||||
{
|
|
||||||
ConnectionSlotEvent event;
|
|
||||||
event.triggerId = this->slotIndex;
|
|
||||||
event.socketTriggered = true;
|
|
||||||
|
|
||||||
ExecutingTaskSafeWrapper safeExecutingTaskMutex(this);
|
|
||||||
slotconnected = 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(slotconnected == false) {
|
|
||||||
if(chrono.getMillis() % 10 == 0) {
|
|
||||||
sleep(100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//else {
|
|
||||||
// this->slot->hasDataToReadWithWait(250);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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__);
|
||||||
@@ -276,8 +250,7 @@ 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();
|
||||||
|
|
||||||
@@ -313,27 +286,27 @@ ConnectionSlot::~ConnectionSlot() {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectionSlot::updateSlot(ConnectionSlotEvent *event) {
|
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());
|
||||||
|
|
||||||
bool slotconnected = this->update(checkForNewClients,event->triggerId);
|
this->update(checkForNewClients,event->triggerId);
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 4) 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() > 4) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());
|
||||||
|
|
||||||
@@ -343,30 +316,27 @@ bool 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());
|
||||||
|
|
||||||
return slotconnected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||||
//Chrono chrono;
|
//Chrono chrono;
|
||||||
//chrono.start();
|
//chrono.start();
|
||||||
pair<bool,Socket*> socketInfo;
|
|
||||||
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());
|
||||||
|
|
||||||
socketInfo = this->getSocketInfo();
|
pair<bool,Socket*> socketInfo = this->getSocketInfo();
|
||||||
if(socketInfo.second == NULL) {
|
if(socketInfo.second == NULL) {
|
||||||
if(networkGameDataSynchCheckOkMap) networkGameDataSynchCheckOkMap = false;
|
if(networkGameDataSynchCheckOkMap) networkGameDataSynchCheckOkMap = false;
|
||||||
if(networkGameDataSynchCheckOkTile) networkGameDataSynchCheckOkTile = false;
|
if(networkGameDataSynchCheckOkTile) networkGameDataSynchCheckOkTile = false;
|
||||||
@@ -494,17 +464,17 @@ bool 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->hasDataToReadWithWait(100) == true && gotTextMsg == true;) {
|
for(;this->hasDataToRead() == true && gotTextMsg == true;) {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] polling for networkMessageType...\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] polling for networkMessageType...\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
NetworkMessageType networkMessageType= getNextMessageType(100);
|
NetworkMessageType networkMessageType= getNextMessageType();
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] networkMessageType = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageType);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] networkMessageType = %d\n",__FILE__,__FUNCTION__,__LINE__,networkMessageType);
|
||||||
|
|
||||||
//gotTextMsg = false;
|
gotTextMsg = false;
|
||||||
//process incoming commands
|
//process incoming commands
|
||||||
switch(networkMessageType) {
|
switch(networkMessageType) {
|
||||||
|
|
||||||
@@ -528,7 +498,7 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
@@ -543,20 +513,20 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(receiveMessage(&networkMessageText)) {
|
if(receiveMessage(&networkMessageText)) {
|
||||||
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex(),networkMessageText.getTargetLanguage());
|
ChatMsgInfo msg(networkMessageText.getText().c_str(),networkMessageText.getTeamIndex(),networkMessageText.getPlayerIndex(),networkMessageText.getTargetLanguage());
|
||||||
this->addChatInfo(msg);
|
this->addChatInfo(msg);
|
||||||
//gotTextMsg = true;
|
gotTextMsg = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -585,14 +555,14 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -620,7 +590,7 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
||||||
|
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//check consistency
|
//check consistency
|
||||||
@@ -658,7 +628,7 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
||||||
close();
|
close();
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,7 +649,7 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -696,7 +666,7 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
||||||
|
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMessageLaunch networkMessageLaunch;
|
NetworkMessageLaunch networkMessageLaunch;
|
||||||
@@ -732,14 +702,14 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -857,14 +827,14 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -886,14 +856,14 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -919,14 +889,14 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -965,14 +935,14 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -995,7 +965,7 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
//sendTextMessage(sErr,-1);
|
//sendTextMessage(sErr,-1);
|
||||||
//DisplayErrorMessage(sErr);
|
//DisplayErrorMessage(sErr);
|
||||||
threadErrorList.push_back(sErr);
|
threadErrorList.push_back(sErr);
|
||||||
return socketInfo.first;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got invalid message type before intro, disconnecting socket.\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got invalid message type before intro, disconnecting socket.\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
@@ -1003,11 +973,11 @@ bool ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d]\nInvalid message type before intro handshake [%d]\nDisconnecting socket for slot: %d [%s].\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageType,this->playerIndex,this->getIpAddress().c_str());
|
||||||
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
this->serverInterface->notifyBadClientConnectAttempt(this->getIpAddress());
|
||||||
close();
|
close();
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
//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());
|
||||||
|
|
||||||
@@ -1035,7 +1005,6 @@ bool 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());
|
||||||
}
|
}
|
||||||
|
|
||||||
return socketInfo.first;
|
|
||||||
//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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1208,14 +1177,4 @@ bool ConnectionSlot::hasDataToRead() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ConnectionSlot::hasDataToReadWithWait(int waitMilliseconds) {
|
|
||||||
bool result = false;
|
|
||||||
MutexSafeWrapper safeMutexSlot(&mutexSocket,CODE_AT_LINE);
|
|
||||||
|
|
||||||
if(socket != NULL && socket->hasDataToRead(waitMilliseconds) == true) {
|
|
||||||
result = true;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
@@ -78,7 +78,6 @@ 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);
|
||||||
@@ -87,8 +86,8 @@ protected:
|
|||||||
void slotUpdateTask(ConnectionSlotEvent *event);
|
void slotUpdateTask(ConnectionSlotEvent *event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ConnectionSlotThread(ConnectionSlot *slot);
|
ConnectionSlotThread(int slotIndex);
|
||||||
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,ConnectionSlot *slot);
|
ConnectionSlotThread(ConnectionSlotCallbackInterface *slotInterface,int slotIndex);
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
void signalUpdate(ConnectionSlotEvent *event);
|
void signalUpdate(ConnectionSlotEvent *event);
|
||||||
bool isSignalCompleted(ConnectionSlotEvent *event);
|
bool isSignalCompleted(ConnectionSlotEvent *event);
|
||||||
@@ -136,7 +135,7 @@ public:
|
|||||||
ConnectionSlot(ServerInterface* serverInterface, int playerIndex);
|
ConnectionSlot(ServerInterface* serverInterface, int playerIndex);
|
||||||
~ConnectionSlot();
|
~ConnectionSlot();
|
||||||
|
|
||||||
bool update(bool checkForNewClients,int lockedSlotIndex);
|
void update(bool checkForNewClients,int lockedSlotIndex);
|
||||||
void setPlayerIndex(int value) { playerIndex = value; }
|
void setPlayerIndex(int value) { playerIndex = value; }
|
||||||
int getPlayerIndex() const {return playerIndex;}
|
int getPlayerIndex() const {return playerIndex;}
|
||||||
|
|
||||||
@@ -191,14 +190,11 @@ public:
|
|||||||
time_t getConnectedTime() const { return connectedTime; }
|
time_t getConnectedTime() const { return connectedTime; }
|
||||||
int getSessionKey() const { return sessionKey; }
|
int getSessionKey() const { return sessionKey; }
|
||||||
|
|
||||||
bool updateSlot(ConnectionSlotEvent *event);
|
void updateSlot(ConnectionSlotEvent *event);
|
||||||
virtual bool isConnected();
|
virtual bool isConnected();
|
||||||
|
|
||||||
PLATFORM_SOCKET getSocketId();
|
PLATFORM_SOCKET getSocketId();
|
||||||
|
|
||||||
bool hasDataToRead();
|
|
||||||
bool hasDataToReadWithWait(int waitMilliseconds);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
Mutex * getServerSynchAccessor();
|
Mutex * getServerSynchAccessor();
|
||||||
@@ -208,6 +204,8 @@ protected:
|
|||||||
void setSocket(Socket *newSocket);
|
void setSocket(Socket *newSocket);
|
||||||
void deleteSocket();
|
void deleteSocket();
|
||||||
virtual void update() {}
|
virtual void update() {}
|
||||||
|
|
||||||
|
bool hasDataToRead();
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
@@ -44,26 +44,25 @@ void NetworkInterface::sendMessage(const NetworkMessage* networkMessage){
|
|||||||
networkMessage->send(socket);
|
networkMessage->send(socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkMessageType NetworkInterface::getNextMessageType(int waitMilliseconds)
|
NetworkMessageType NetworkInterface::getNextMessageType()
|
||||||
{
|
{
|
||||||
Socket* socket= getSocket(false);
|
Socket* socket= getSocket(false);
|
||||||
int8 messageType= nmtInvalid;
|
int8 messageType= nmtInvalid;
|
||||||
|
|
||||||
if(socket != NULL &&
|
if(socket != NULL &&
|
||||||
socket->hasDataToReadWithWait(waitMilliseconds) == true) {
|
socket->hasDataToRead() == true) {
|
||||||
|
|
||||||
//peek message type
|
//peek message type
|
||||||
//int dataSize = socket->getDataToRead();
|
int dataSize = socket->getDataToRead();
|
||||||
//if(dataSize >= sizeof(messageType)) {
|
if(dataSize >= sizeof(messageType)) {
|
||||||
//if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] socket->getDataToRead() dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,dataSize);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] socket->getDataToRead() dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,dataSize);
|
||||||
|
|
||||||
int iPeek = socket->peek(&messageType, sizeof(messageType));
|
int iPeek = socket->peek(&messageType, sizeof(messageType));
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] socket->getDataToRead() iPeek = %d, messageType = %d [size = %d]\n",__FILE__,__FUNCTION__,__LINE__,iPeek,messageType,sizeof(messageType));
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] socket->getDataToRead() iPeek = %d, messageType = %d [size = %d]\n",__FILE__,__FUNCTION__,__LINE__,iPeek,messageType,sizeof(messageType));
|
||||||
//}
|
}
|
||||||
//else {
|
else {
|
||||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] PEEK WARNING, socket->getDataToRead() messageType = %d [size = %d], dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,messageType,sizeof(messageType),dataSize);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] PEEK WARNING, socket->getDataToRead() messageType = %d [size = %d], dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,messageType,sizeof(messageType),dataSize);
|
||||||
//}
|
}
|
||||||
|
|
||||||
//sanity check new message type
|
//sanity check new message type
|
||||||
if(messageType < 0 || messageType >= nmtCount) {
|
if(messageType < 0 || messageType >= nmtCount) {
|
||||||
@@ -109,24 +108,19 @@ void NetworkInterface::DisplayErrorMessage(string sErr, bool closeSocket) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ChatMsgInfo> NetworkInterface::getChatTextList(bool clearAfterRetrieve) {
|
std::vector<ChatMsgInfo> NetworkInterface::getChatTextList(bool clearList) {
|
||||||
std::vector<ChatMsgInfo> result;
|
std::vector<ChatMsgInfo> result;
|
||||||
MutexSafeWrapper safeMutex(&mutexChatTextList,CODE_AT_LINE);
|
if(chatTextList.empty() == false) {
|
||||||
result = chatTextList;
|
result = chatTextList;
|
||||||
if(clearAfterRetrieve == true) {
|
|
||||||
chatTextList.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(clearList == true) {
|
||||||
|
chatTextList.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
return result;
|
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,7 +93,6 @@ protected:
|
|||||||
string networkGameDataSynchCheckTechMismatchReport;
|
string networkGameDataSynchCheckTechMismatchReport;
|
||||||
bool receivedDataSynchCheck;
|
bool receivedDataSynchCheck;
|
||||||
|
|
||||||
Mutex mutexChatTextList;
|
|
||||||
std::vector<ChatMsgInfo> chatTextList;
|
std::vector<ChatMsgInfo> chatTextList;
|
||||||
NetworkMessagePing lastPingInfo;
|
NetworkMessagePing lastPingInfo;
|
||||||
|
|
||||||
@@ -121,7 +120,7 @@ public:
|
|||||||
string getHostName() const {return Socket::getHostName();}
|
string getHostName() const {return Socket::getHostName();}
|
||||||
|
|
||||||
virtual void sendMessage(const NetworkMessage* networkMessage);
|
virtual void sendMessage(const NetworkMessage* networkMessage);
|
||||||
NetworkMessageType getNextMessageType(int waitMilliseconds=100);
|
NetworkMessageType getNextMessageType();
|
||||||
bool receiveMessage(NetworkMessage* networkMessage);
|
bool receiveMessage(NetworkMessage* networkMessage);
|
||||||
|
|
||||||
virtual bool isConnected();
|
virtual bool isConnected();
|
||||||
@@ -142,9 +141,9 @@ public:
|
|||||||
virtual bool getNetworkGameDataSynchCheckOkTile() { return networkGameDataSynchCheckOkTile; }
|
virtual bool getNetworkGameDataSynchCheckOkTile() { return networkGameDataSynchCheckOkTile; }
|
||||||
virtual bool getNetworkGameDataSynchCheckOkTech() { return networkGameDataSynchCheckOkTech; }
|
virtual bool getNetworkGameDataSynchCheckOkTech() { return networkGameDataSynchCheckOkTech; }
|
||||||
|
|
||||||
std::vector<ChatMsgInfo> getChatTextList(bool clearAfterRetrieve);
|
std::vector<ChatMsgInfo> getChatTextList(bool clearList);
|
||||||
void clearChatInfo();
|
void clearChatInfo();
|
||||||
void addChatInfo(const ChatMsgInfo &msg);
|
void addChatInfo(const ChatMsgInfo &msg) { chatTextList.push_back(msg); }
|
||||||
|
|
||||||
virtual bool getConnectHasHandshaked() const= 0;
|
virtual bool getConnectHasHandshaked() const= 0;
|
||||||
|
|
||||||
|
@@ -882,110 +882,6 @@ 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) {
|
||||||
@@ -1010,13 +906,13 @@ void ServerInterface::dispatchPendingChatMessages(std::vector <string> &errorMsg
|
|||||||
ConnectionSlot* connectionSlot= slots[i];
|
ConnectionSlot* connectionSlot= slots[i];
|
||||||
if(connectionSlot != NULL &&
|
if(connectionSlot != NULL &&
|
||||||
connectionSlot->getChatTextList(false).empty() == false) {
|
connectionSlot->getChatTextList(false).empty() == false) {
|
||||||
|
std::vector<ChatMsgInfo> chatList = connectionSlot->getChatTextList(true);
|
||||||
try {
|
try {
|
||||||
std::vector<ChatMsgInfo> chatList = connectionSlot->getChatTextList(true);
|
|
||||||
for(int chatIdx = 0;
|
for(int chatIdx = 0;
|
||||||
exitServer == false &&
|
exitServer == false && slots[i] != NULL &&
|
||||||
chatIdx < chatList.size(); chatIdx++) {
|
chatIdx < chatList.size(); chatIdx++) {
|
||||||
//connectionSlot= slots[i];
|
connectionSlot= slots[i];
|
||||||
//if(connectionSlot != NULL) {
|
if(connectionSlot != NULL) {
|
||||||
ChatMsgInfo msg(chatList[chatIdx]);
|
ChatMsgInfo msg(chatList[chatIdx]);
|
||||||
this->addChatInfo(msg);
|
this->addChatInfo(msg);
|
||||||
|
|
||||||
@@ -1033,7 +929,7 @@ 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);
|
||||||
@@ -1075,44 +971,41 @@ 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());
|
||||||
@@ -1129,27 +1022,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");
|
||||||
}
|
}
|
||||||
@@ -1343,7 +1236,7 @@ void ServerInterface::waitUntilReady(Checksum *checksum) {
|
|||||||
ConnectionSlot* connectionSlot= slots[i];
|
ConnectionSlot* connectionSlot= slots[i];
|
||||||
if(connectionSlot != NULL && connectionSlot->isConnected() == true) {
|
if(connectionSlot != NULL && connectionSlot->isConnected() == true) {
|
||||||
if(connectionSlot->isReady() == false) {
|
if(connectionSlot->isReady() == false) {
|
||||||
NetworkMessageType networkMessageType= connectionSlot->getNextMessageType(0);
|
NetworkMessageType networkMessageType= connectionSlot->getNextMessageType();
|
||||||
|
|
||||||
// consume old messages from the lobby
|
// consume old messages from the lobby
|
||||||
bool discarded = shouldDiscardNetworkMessage(networkMessageType,connectionSlot);
|
bool discarded = shouldDiscardNetworkMessage(networkMessageType,connectionSlot);
|
||||||
|
@@ -207,7 +207,6 @@ 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);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user