mirror of
https://github.com/glest/glest-source.git
synced 2025-02-25 12:12:25 +01:00
- Attempted fix for some synch network errors (ensure client messages are processed in proper order)
This commit is contained in:
parent
2504baad20
commit
f92bf42d82
@ -147,7 +147,8 @@ void ConnectionSlot::update(bool checkForNewClients) {
|
||||
NetworkMessageCommandList networkMessageCommandList;
|
||||
if(receiveMessage(&networkMessageCommandList)) {
|
||||
for(int i= 0; i<networkMessageCommandList.getCommandCount(); ++i) {
|
||||
serverInterface->requestCommand(networkMessageCommandList.getCommand(i));
|
||||
//serverInterface->requestCommand(networkMessageCommandList.getCommand(i));
|
||||
vctPendingNetworkCommandList.push_back(*networkMessageCommandList.getCommand(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ private:
|
||||
bool receivedNetworkGameStatus;
|
||||
time_t connectedTime;
|
||||
bool gotIntro;
|
||||
vector<NetworkCommand> vctPendingNetworkCommandList;
|
||||
|
||||
public:
|
||||
ConnectionSlot(ServerInterface* serverInterface, int playerIndex);
|
||||
@ -68,6 +69,9 @@ public:
|
||||
std::vector<std::string> getThreadErrorList() const { return threadErrorList; }
|
||||
void clearThreadErrorList() { threadErrorList.clear(); }
|
||||
|
||||
vector<NetworkCommand> getPendingNetworkCommandList() { return vctPendingNetworkCommandList; }
|
||||
void clearPendingNetworkCommandList() { vctPendingNetworkCommandList.clear(); }
|
||||
|
||||
protected:
|
||||
|
||||
Mutex * getServerSynchAccessor();
|
||||
|
@ -440,6 +440,20 @@ void ServerInterface::update() {
|
||||
sleep(0);
|
||||
}
|
||||
|
||||
for(int i= 0; i< GameConstants::maxPlayers; ++i) {
|
||||
ConnectionSlot* connectionSlot= slots[i];
|
||||
if(connectionSlot != NULL && connectionSlot->isConnected() == true &&
|
||||
connectionSlot->getPendingNetworkCommandList().size() > 0) {
|
||||
vector<NetworkCommand> vctPendingNetworkCommandList = connectionSlot->getPendingNetworkCommandList();
|
||||
|
||||
for(int idx = 0; idx < vctPendingNetworkCommandList.size(); ++idx) {
|
||||
NetworkCommand &cmd = vctPendingNetworkCommandList[idx];
|
||||
this->requestCommand(&cmd);
|
||||
}
|
||||
connectionSlot->clearPendingNetworkCommandList();
|
||||
}
|
||||
}
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//process text messages
|
||||
|
Loading…
x
Reference in New Issue
Block a user