Fix client disconnect from leftover socket recv timeout
Clear the 5-second SO_RCVTIMEO that was set during the connection handshake but never removed. The timeout persisted into the game session, causing the client to disconnect whenever the server paused for longer than 5 seconds (e.g. autosave, chunk I/O). Also update README with chunk unloading and connection stability fixes.
This commit is contained in:
@@ -927,6 +927,7 @@ bool ServerChunkCache::tick()
|
||||
int ix = chunk->x + XZOFFSET;
|
||||
int iz = chunk->z + XZOFFSET;
|
||||
int idx = ix * XZSIZE + iz;
|
||||
delete m_unloadedCache[idx];
|
||||
m_unloadedCache[idx] = chunk;
|
||||
cache[idx] = nullptr;
|
||||
}
|
||||
|
||||
@@ -455,6 +455,12 @@ bool WinsockNetLayer::JoinGame(const char* ip, int port)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Clear the recv timeout now that the handshake is complete.
|
||||
// The recv thread should block indefinitely waiting for data.
|
||||
DWORD noTimeout = 0;
|
||||
setsockopt(s_hostConnectionSocket, SOL_SOCKET, SO_RCVTIMEO, (const char*)&noTimeout, sizeof(noTimeout));
|
||||
|
||||
s_localSmallId = assignedSmallId;
|
||||
|
||||
// Save the host IP and port so JoinSplitScreen can connect to the same host
|
||||
|
||||
Reference in New Issue
Block a user