1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add propper client initialization

-add client states to avoid server sending data to uninitialized clients
  -don't show uninitialized clients to other players
  -propper client disconnect handling
Minor comment fixes in server
Minor bugfixes in connection
  -improved peer id calculation
  -honor NDEBUG flag
  -improved disconnect handling
  -increased initial send window
Remove some dead code
This commit is contained in:
sapier 2014-01-31 00:24:00 +01:00
parent 21f1bec724
commit e258675eab
10 changed files with 1818 additions and 1609 deletions

View file

@ -592,23 +592,12 @@ void *EmergeThread::Thread() {
/*
Set sent status of modified blocks on clients
*/
// NOTE: Server's clients are also behind the connection mutex
//conlock: consistently takes 30-40ms to acquire
JMutexAutoLock lock(m_server->m_con_mutex);
// Add the originally fetched block to the modified list
if (block)
modified_blocks[p] = block;
// Set the modified blocks unsent for all the clients
for (std::map<u16, RemoteClient*>::iterator
i = m_server->m_clients.begin();
i != m_server->m_clients.end(); ++i) {
RemoteClient *client = i->second;
if (modified_blocks.size() > 0) {
// Remove block from sent history
client->SetBlocksNotSent(modified_blocks);
}
if (modified_blocks.size() > 0) {
m_server->SetBlocksNotSent(modified_blocks);
}
}
catch (VersionMismatchException &e) {