コード例 #1
0
        public void CheckStatus(TransportClient client, long lastWrite, long lastRead, long lastConnect)
        {
            if (client.IsClose)
            {
                return;
            }
            long now = DateTime.Now.ToTime();

            if (now - _lastCheck < _pingInterval)
            {
                return;
            }
            _lastCheck = now;

            if (!client.IsConnected())
            {
                return;
            }
            if (IsSessionTimeout(now, lastRead, lastConnect))
            {
                SessionTimeout(client);
                return;
            }
            if (IsWriteIdleTimeout(now, lastWrite) || IsReadIdleTimeout(now, lastRead))
            {
                Ping(client);
            }
        }
コード例 #2
0
 protected abstract void Ping(TransportClient client);
コード例 #3
0
 protected virtual void SessionTimeout(TransportClient client)
 {
     client.CloseChannel();
 }