private void SendHeartBeat(object source, ElapsedEventArgs e) { var span = DateTime.Now - _lastTime; _timeout = (int)span.TotalMilliseconds; if (_timeout > _interval * 2) { SkynetLogger.Info(Channel.NetDevice, "timeout disconnect"); _client.Disconnect(); } else { _client.Request("heartbeat", (SpObject obj) => { ResetTimeout(); }); } }
private void Disconnect() { _client.Disconnect(); }