push whatever is left before i go for the night lol

This commit is contained in:
SilicaAndPina 2021-02-14 00:23:25 +13:00
parent bd16f0386a
commit 2e1174efbb

View file

@ -93,6 +93,7 @@ namespace HISP.Server
LoggedinUser.Tiredness--;
}
if(!isDisconnecting)
minuteTimer.Change(oneMinute, oneMinute);
dcLock = false;
}
@ -148,7 +149,7 @@ namespace HISP.Server
// HI1 Packets are terminates by 0x00 so we have to read until we receive that terminator
while(ClientSocket.Connected)
while(ClientSocket.Connected && !isDisconnecting)
{
if(isDisconnecting)
break;
@ -180,7 +181,7 @@ namespace HISP.Server
}
}
}
catch(SocketException e)
catch(SocketException)
{
Disconnect();
break;
@ -190,7 +191,8 @@ namespace HISP.Server
while (dcLock) { }; // Refuse to shut down until dcLock is cleared. (prevents TOCTOU issues.)
// Shutdown sockets
// Stop Timers
if (updateTimer != null)
updateTimer.Dispose();
if(inactivityTimer != null)
@ -200,14 +202,15 @@ namespace HISP.Server
if(kickTimer != null)
kickTimer.Dispose();
// Call OnDisconnect
GameServer.OnDisconnect(this);
LoggedIn = false;
LoggedinUser = null;
// Close Sockets
ClientSocket.Close();
ClientSocket.Dispose();
return isDisconnecting; // Stop the thread.
}
private void parsePackets(byte[] Packet)