WIP Clients are working properly, servers are not.

This commit is contained in:
Jocke
2016-02-09 11:43:16 +01:00
parent ba9419b342
commit fccd8c64e7
19 changed files with 277 additions and 166 deletions
+2 -22
View File
@@ -7,8 +7,7 @@ TCPServer::TCPServer()
}
TCPServer::~TCPServer()
{
}
{ }
void TCPServer::readFromClients()
{
@@ -30,25 +29,6 @@ void TCPServer::readFromClients()
}
}
}
std::clock_t currentTime = std::clock();
// Send snapshot
if (snapshotInterval < (1000 * (currentTime - previousSnapshotMessage) / (double)CLOCKS_PER_SEC)) {
sendSnapshot();
previousSnapshotMessage = currentTime;
}
// Send pings each
if (pingIntervalMs < (1000 * (currentTime - previousePingMessage) / (double)CLOCKS_PER_SEC)) {
sendPing();
previousePingMessage = currentTime;
}
// Time out logic
if (checkTimeOutInterval < (1000 * (currentTime - timOutTimer) / (double)CLOCKS_PER_SEC)) {
checkForTimeOuts();
timOutTimer = currentTime;
}
}
void TCPServer::acceptNewConnections()
@@ -80,7 +60,7 @@ void TCPServer::parseConnect(Packet & packet)
LOG_INFO("Parsing connections");
// Check if player is already connected
PlayerID playerID = GetPlayerIDFromEndpoint();
if(playerID = -1){
if (playerID = -1) {
return;
}