Bugfix with listen server

Added null check for keepalive timer callback to prevent server
application from crashing when stopping the listen server when client(s)
connect and initiate the keepalive timer
This commit is contained in:
d3agle 2015-03-14 09:10:45 -05:00
parent 057ae503c0
commit e64819673d
1 changed files with 6 additions and 3 deletions

View File

@ -207,10 +207,13 @@ namespace xServer.Core
{
KeepAlive keepAlive = (KeepAlive)state;
if (_keepAlives.Contains(keepAlive))
if (_keepAlives != null)
{
keepAlive.Client.Disconnect();
_keepAlives.Remove(keepAlive);
if (_keepAlives.Contains(keepAlive))
{
keepAlive.Client.Disconnect();
_keepAlives.Remove(keepAlive);
}
}
}