newnet: Change popped too much assert to warning, since the queue might have been cleared if a player disconnects. May still wait for NET_GAME_TIME messages from the player that no longer exists.

master
Cyp 2010-02-12 01:11:01 +01:00
parent d1ba8c087b
commit 1943e08ba8
3 changed files with 8 additions and 8 deletions

View File

@ -1364,6 +1364,7 @@ static void NETplayerDropped(UDWORD index)
debug(LOG_INFO, "NET_PLAYER_DROPPED received for player %d", id);
NET_DestroyPlayer(id); // just clears array
MultiPlayerLeave(id); // more cleanup
NET_PlayerConnectionStatus = 2; //DROPPED_CONNECTION
}
@ -2455,13 +2456,7 @@ BOOL NETrecvNet(NETQUEUE *queue, uint8_t *type)
if (NetPlay.isHost)
{
// Send message type specifically for dropped / disconnects
NETbeginEncode(NETbroadcastQueue(), NET_PLAYER_DROPPED);
NETuint32_t(&current);
NETend();
debug(LOG_INFO, "sending NET_PLAYER_DROPPED for player %d (invalid socket)", (int)current);
NET_DestroyPlayer(current); // just clears array
MultiPlayerLeave(current); // more cleanup
NET_PlayerConnectionStatus = 2; // Display DROPPED_CONNECTION icon ingame.
NETplayerDropped(current);
NetPlay.players[current].kick = true; // they are going to get kicked.
}
}

View File

@ -74,7 +74,11 @@ void NetQueue::readRawData(const uint8_t **netData, size_t *netLen)
void NetQueue::popRawData(size_t netLen)
{
ASSERT(canReadRawData, "Wrong NetQueue type for popRawData.");
ASSERT(netLen <= unsentMessageData.size(), "Popped too much data!");
if (netLen > unsentMessageData.size())
{
debug(LOG_WARNING, "Popped too much data (popped %zu, had %zu). Someone probably just disconnected.", netLen, unsentMessageData.size());
netLen = unsentMessageData.size();
}
// Pop the data.
unsentMessageData.erase(unsentMessageData.begin(), unsentMessageData.begin() + netLen);

View File

@ -2992,6 +2992,7 @@ void frontendMultiMessages(void)
MultiPlayerLeave(player_id); // get rid of their stuff
NET_PlayerConnectionStatus = 2; //DROPPED_CONNECTION
if (host) // host has quit, need to quit too.
{
stopJoining();