mirror of
https://github.com/islehorse/HISP.git
synced 2025-04-07 13:45:42 +12:00
push whatever is left before i go for the night lol
This commit is contained in:
parent
bd16f0386a
commit
2e1174efbb
1 changed files with 11 additions and 8 deletions
|
@ -93,7 +93,8 @@ namespace HISP.Server
|
|||
LoggedinUser.Tiredness--;
|
||||
}
|
||||
|
||||
minuteTimer.Change(oneMinute, oneMinute);
|
||||
if(!isDisconnecting)
|
||||
minuteTimer.Change(oneMinute, oneMinute);
|
||||
dcLock = false;
|
||||
}
|
||||
private void keepAliveTimerTick(object state)
|
||||
|
@ -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;
|
||||
|
@ -188,10 +189,11 @@ namespace HISP.Server
|
|||
|
||||
}
|
||||
|
||||
while(dcLock) { }; // Refuse to shut down until dcLock is cleared. (prevents TOCTOU issues.)
|
||||
|
||||
// Shutdown sockets
|
||||
if(updateTimer != null)
|
||||
while (dcLock) { }; // Refuse to shut down until dcLock is cleared. (prevents TOCTOU issues.)
|
||||
|
||||
|
||||
// Stop Timers
|
||||
if (updateTimer != null)
|
||||
updateTimer.Dispose();
|
||||
if(inactivityTimer != null)
|
||||
inactivityTimer.Dispose();
|
||||
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue