private void ScheduleFullClientPing() { RemoveFullClientPingIfPossible(); _fullClientHeartbeat = new WakeLockBalancer.GracefulWakeLock(new WakeLockBalancer.ActionObject(() => { if (!IsFullClientConnected) { RemoveFullClientPingIfPossible(); } else { Ping(_fullClient); try { SendPresence(_fullClient); } catch (Exception ex) { Utils.DebugPrint("Failed to send presence in full client ping: " + ex); // fall-through } } }, WakeLockBalancer.ActionObject.ExecuteType.TaskWithWakeLock), 240, 60, true); Platform.ScheduleAction(_fullClientHeartbeat); }
private void RemoveFullClientPingIfPossible() { if (_fullClientHeartbeat != null) { Platform.RemoveAction(_fullClientHeartbeat); _fullClientHeartbeat = null; } }
private void RemoveLongPollPingIfPossible() { if (_longPollHeartbeart != null) { Platform.RemoveAction(_longPollHeartbeart); _longPollHeartbeart = null; } }
private void ScheduleLongPollPing() { RemoveLongPollPingIfPossible(); _longPollHeartbeart = new WakeLockBalancer.GracefulWakeLock(new WakeLockBalancer.ActionObject(() => { if (_longPollClient == null || !_longPollClient.IsConnected) { RemoveLongPollPingIfPossible(); RestartTelegram(null); } else { Ping(_longPollClient, RestartTelegram); } }, WakeLockBalancer.ActionObject.ExecuteType.TaskWithWakeLock), 240, 60, true); Platform.ScheduleAction(_longPollHeartbeart); }
private void ScheduleFullClientPing() { RemoveFullClientPingIfPossible(); _fullClientHeartbeat = new WakeLockBalancer.GracefulWakeLock(new WakeLockBalancer.ActionObject(() => { if (!IsFullClientConnected) { RemoveFullClientPingIfPossible(); } else { Ping(_fullClient); } }, WakeLockBalancer.ActionObject.ExecuteType.TaskWithWakeLock), 240, 60, true); Platform.ScheduleAction(_fullClientHeartbeat); }