/// <summary> /// Callback method to handle errors. /// </summary> /// <param name="client">The client to receive messages from.</param> /// <param name="exception">The generated exception.</param> internal void ClientErrorHandler(AsyncSocketClient client, Exception exception) { //fire off an error handler if (OnError != null) { CommonErrorEventArgs e = new CommonErrorEventArgs(exception); OnError(this, e); } }
private void DispatchOnError(CommonErrorEventArgs e) { if (OnError != null) { try { OnError(this, e); } catch (Exception ex) { _Log.Error("Unhandled exception thrown OnError event handler.", ex); } } }
/// <summary> /// Callback method to handle received messages. The AsyncSocketClient /// library calls this; don't call it yourself. /// </summary> /// <param name="client">The client to receive messages from.</param> internal void ClientMessageHandler(AsyncSocketClient client) { try { Queue responseQueue = new PduFactory().GetPduQueue(client.Buffer); ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessPduQueue), responseQueue); } catch (Exception exception) { if (OnError != null) { CommonErrorEventArgs e = new CommonErrorEventArgs(exception); OnError(this, e); } } }
void communicator_OnError(object source, CommonErrorEventArgs e) { //Ошибка работы комуникатора PerformanceCountersService.GetCounter(CONNECTION_COUNTER_NAME).Decrement(); }