private void HandlePingTimeout(IoSession session) { ResetStatus(session); IKeepAliveRequestTimeoutHandler handler = _requestTimeoutHandler; if (handler == KeepAliveRequestTimeoutHandler.DeafSpeaker) { return; } handler.KeepAliveRequestTimedOut(this, session); }
public KeepAliveFilter(IKeepAliveMessageFactory messageFactory, IdleStatus interestedIdleStatus, IKeepAliveRequestTimeoutHandler strategy, Int32 keepAliveRequestInterval, Int32 keepAliveRequestTimeout) { if (messageFactory == null) throw new ArgumentNullException("messageFactory"); if (strategy == null) throw new ArgumentNullException("strategy"); WAITING_FOR_RESPONSE = new AttributeKey(GetType(), "waitingForResponse"); IGNORE_READER_IDLE_ONCE = new AttributeKey(GetType(), "ignoreReaderIdleOnce"); _messageFactory = messageFactory; _interestedIdleStatus = interestedIdleStatus; _requestTimeoutHandler = strategy; RequestInterval = keepAliveRequestInterval; RequestTimeout = keepAliveRequestTimeout; }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="messageFactory">the factory to generate keep-alive messages</param> /// <param name="interestedIdleStatus"></param> /// <param name="strategy"></param> /// <param name="keepAliveRequestInterval">the interval to send a keep-alive request</param> /// <param name="keepAliveRequestTimeout">the time to wait for a keep-alive response before timed out</param> public KeepAliveFilter(IKeepAliveMessageFactory messageFactory, IdleStatus interestedIdleStatus, IKeepAliveRequestTimeoutHandler strategy, Int32 keepAliveRequestInterval, Int32 keepAliveRequestTimeout) { if (messageFactory == null) { throw new ArgumentNullException("messageFactory"); } if (strategy == null) { throw new ArgumentNullException("strategy"); } WAITING_FOR_RESPONSE = new AttributeKey(GetType(), "waitingForResponse"); IGNORE_READER_IDLE_ONCE = new AttributeKey(GetType(), "ignoreReaderIdleOnce"); _messageFactory = messageFactory; _interestedIdleStatus = interestedIdleStatus; _requestTimeoutHandler = strategy; RequestInterval = keepAliveRequestInterval; RequestTimeout = keepAliveRequestTimeout; }
/// <summary> /// Creates a new instance with the default properties. /// <ul> /// <li>keepAliveRequestInterval - 60 (seconds)</li> /// <li>keepAliveRequestTimeout - 30 (seconds)</li> /// </ul> /// </summary> /// <param name="messageFactory">the factory to generate keep-alive messages</param> /// <param name="interestedIdleStatus"></param> /// <param name="strategy"></param> public KeepAliveFilter(IKeepAliveMessageFactory messageFactory, IdleStatus interestedIdleStatus, IKeepAliveRequestTimeoutHandler strategy) : this(messageFactory, interestedIdleStatus, strategy, 60, 30) { }
/// <summary> /// Creates a new instance with the default properties. /// <ul> /// <li>interestedIdleStatus - <see cref="IdleStatus.ReaderIdle"/></li> /// <li>keepAliveRequestInterval - 60 (seconds)</li> /// <li>keepAliveRequestTimeout - 30 (seconds)</li> /// </ul> /// </summary> /// <param name="messageFactory">the factory to generate keep-alive messages</param> /// <param name="strategy"></param> public KeepAliveFilter(IKeepAliveMessageFactory messageFactory, IKeepAliveRequestTimeoutHandler strategy) : this(messageFactory, IdleStatus.ReaderIdle, strategy) { }