private void ConnectionOnConnectionClose(object sender, EventArgs eventArgs)
{
ITcpTransportLayer connection = (ITcpTransportLayer)sender;
if (!connection.Disconnected)
{
// Send the disconnect packet sequence (-> dis <- ack <- dis_rs)
_tcpConnectionHelper.DisconnectConnection(connection.ConnectionId, connection.LastSeqSent);
} else
{
SendData(new StandardDisconnectRsPacket(connection.RemoteConnectionId));
}
// remove the connection from our list of open connections
_tcpConnections.Remove(connection.ConnectionId);
}