internal TCPLinkWatch(TCPLink _tcp, NetCoreSpec spec) { watchdog = new System.Timers.Timer(); watchdog.Interval = spec.ClientReconnectDelay; watchdog.Elapsed += Watchdog_Elapsed; tcp = _tcp; tcp.StartNetworking(); watchdog.Start(); }
private void Watchdog_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { lock (watchLock) { if ((tcp.status == NetworkStatus.DISCONNECTED || tcp.status == NetworkStatus.CONNECTIONLOST)) { tcp.StopNetworking(false); tcp.StartNetworking(); } } }