public virtual void Kill()
{
if (this.State != ClientState.Dead)
{
try { this.Socket.Shutdown(SocketShutdown.Both); }
catch { }
try { this.Socket.Close(); }
catch { }
try
{
// Naturally, we have to clean up after killing somebody.
this.CleanUp();
}
catch (Exception ex)
{
Log.Exception(ex, "While cleaning up after client.");
}
this.State = ClientState.Dead;
}
else
{
Log.Warning("Client got killed multiple times." + Environment.NewLine + Environment.StackTrace);
}
}