コード例 #1
0
ファイル: Request.cs プロジェクト: nvanlaerebeke/mitto
        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...");
        }
コード例 #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);
        }
コード例 #3
0
        public void Close()
        {
            KeepAliveMonitor.TimeOut      -= KeepAliveMonitor_TimeOut;
            KeepAliveMonitor.UnResponsive -= KeepAliveMonitor_UnResponsive;
            KeepAliveMonitor.Stop();

            Consumer.Close();
            Disconnected?.Invoke(this, this);
        }
コード例 #4
0
ファイル: Client.cs プロジェクト: nvanlaerebeke/mitto
        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();
        }
コード例 #5
0
ファイル: WebsocketClient.cs プロジェクト: hdecoster/mitto
        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();
        }
コード例 #6
0
 private void EndRequest()
 {
     KeepAliveMonitor.TimeOut      -= KeepAliveMonitor_TimeOut;
     KeepAliveMonitor.UnResponsive -= KeepAliveMonitor_UnResponsive;
     KeepAliveMonitor.Stop();
 }