Exemplo n.º 1
0
        private void HandlePingTimeout(IoSession session)
        {
            ResetStatus(session);
            IKeepAliveRequestTimeoutHandler handler = _requestTimeoutHandler;

            if (handler == KeepAliveRequestTimeoutHandler.DeafSpeaker)
            {
                return;
            }
            handler.KeepAliveRequestTimedOut(this, session);
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        /// <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;
        }
Exemplo n.º 4
0
 /// <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)
 { }
Exemplo n.º 5
0
 /// <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)
 { }
Exemplo n.º 6
0
 /// <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)
 {
 }
Exemplo n.º 7
0
 /// <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)
 {
 }