This project is read-only.
1
Vote

Implemention of PING/PONG unable to detect connection failures

description

The OnPingTimerCallback refuses to send another PING until it first receives a pending PONG, thus rendering the websocket unable to detect connection failures.

Suggested fix is to either:
  • detect when a pong "timeout" has occurred and call a user supplied "pong timeout handler."
  • send an un-solicited PONG:
        private void OnPingTimerCallback(object state)
        {
            if (!string.IsNullOrEmpty(m_LastPingRequest) && !m_LastPingRequest.Equals(LastPongResponse))
            {
                //have not got last response
                try {
                    protocolProcessor.SendPong(this, "");
                } catch (Exception e) {
                    OnError(e);
                }
                return;
            }
            // ...
        }

comments