private void OnConnectionFailed(ITcpConnection connection, SocketError socketError) { if (Interlocked.CompareExchange(ref _isClosed, 1, 0) != 0) { return; } Log.Info("Connection '{0}#{1:d}' to [{2}] failed: {3}.", ConnectionName, ConnectionId, connection.RemoteEndPoint, socketError); if (_connectionClosed != null) { _connectionClosed(this, socketError); } _framer.Cleanup(); }