Example #1
0
        /// <summary>
        /// This is utilized whenever a client crashes.
        /// </summary>
        /// <param name="sender">This is the client.</param>
        /// <param name="phoenixClientExceptionEventArgs">This contains the client information.</param>
        private void PClientOnException(object sender, PhoenixClientExceptionEventArgs phoenixClientExceptionEventArgs)
        {
            // raise the event.
            ClientException(this,
                            new PhoenixServerClientExceptionEventArgs
            {
                Client    = sender as Client.Client,
                Exception = phoenixClientExceptionEventArgs.Exception
            });

            lock (_clients)
            {
                // remove the client
                _clients.Remove(sender as Client.Client);
            }

            // assert the not null value of the client.
            var client = sender as Client.Client;

            if (client != null)
            {
                // unhinge events
                client.DataReceived -= PClientOnDataReceived;
                client.Disconnected -= PClientOnDisconnected;
                client.Exception    -= PClientOnException;
            }
        }
Example #2
0
 private void ClientOnException(object sender, PhoenixClientExceptionEventArgs phoenixClientExceptionEventArgs)
 {
     Log("exception");
     Log(phoenixClientExceptionEventArgs.Exception.ToString());
     _client.DataReceived          -= ClientOnDataReceived;
     _client.ConnectionEstablished -= ClientOnConnectionEstablished;
     _client.Disconnected          -= ClientOnDisconnected;
     _client.Exception             -= ClientOnException;
 }