Esempio n. 1
0
        private void _objKeepAliveMonitor_UnResponsive(object sender, EventArgs e)
        {
            _objKeepAliveMonitor.Stop();

            SetResponse(
                MessagingFactory.Provider.GetResponseMessage(
                    typeof(T),
                    Message,
                    new ResponseStatus(ResponseState.TimeOut)
                    )
                );
            RequestTimedOut?.Invoke(sender, this);

            Log.Info($"Request {Message.Name}({Message.ID}) unresponsive on {_objClient.ID}, cleaning up...");
        }
Esempio n. 2
0
        private void KeepAliveMonitor_TimeOut(object sender, EventArgs e)
        {
            Log.Info($"Frame {Frame.RequestID} timed out");

            KeepAliveMonitor.TimeOut -= KeepAliveMonitor_TimeOut;
            KeepAliveMonitor.Stop();

            RequestTimedOut?.Invoke(this, this);
        }
Esempio n. 3
0
        public void Close()
        {
            KeepAliveMonitor.TimeOut      -= KeepAliveMonitor_TimeOut;
            KeepAliveMonitor.UnResponsive -= KeepAliveMonitor_UnResponsive;
            KeepAliveMonitor.Stop();

            Consumer.Close();
            Disconnected?.Invoke(this, this);
        }
Esempio n. 4
0
        public void Disconnect()
        {
            Log.Info($"Closing {ID}");

            _objKeepAliveMonitor.TimeOut      -= _objKeepAliveMonitor_TimeOut;
            _objKeepAliveMonitor.UnResponsive -= _objKeepAliveMonitor_UnResponsive;

            _objClient.OnCloseReceived   -= _objClient_OnCloseReceived;
            _objClient.OnErrorReceived   -= _objClient_OnErrorReceived;
            _objClient.OnMessageReceived -= _objClient_OnMessageReceived;

            //_objCancelationSource.Cancel();
            Disconnected?.Invoke(this, this);

            _objClient.Close();
            _objKeepAliveMonitor.Stop();
        }
Esempio n. 5
0
        private void Close()
        {
            Log.Info($"Closing connection: {ID}");

            _objKeepAliveMonitor.TimeOut      -= _objKeepAliveMonitor_TimeOut;
            _objKeepAliveMonitor.UnResponsive -= _objKeepAliveMonitor_UnResponsive;

            _objWebSocketClient.OnOpen    -= Connection_OnOpen;
            _objWebSocketClient.OnClose   -= Connection_OnClose;
            _objWebSocketClient.OnError   -= Connection_OnError;
            _objWebSocketClient.OnMessage -= Connection_OnMessage;

            if (
                _objWebSocketClient.ReadyState != WebSocketState.Closing &&
                _objWebSocketClient.ReadyState != WebSocketState.Closed
                )
            {
                _objWebSocketClient.Close();
            }
            _objKeepAliveMonitor.Stop();
        }
Esempio n. 6
0
 private void EndRequest()
 {
     KeepAliveMonitor.TimeOut      -= KeepAliveMonitor_TimeOut;
     KeepAliveMonitor.UnResponsive -= KeepAliveMonitor_UnResponsive;
     KeepAliveMonitor.Stop();
 }