public void SetEnabled(bool enabled) { _mutex.Lock(); try { if (_enabled == enabled) { return; } if (enabled) { _enabled = true; _discardLogs = false; _stateKeeper.InvalidateState(); CheckPendingLogs(); } else { Suspend(true, new CancellationException()); } } finally { _mutex.Unlock(); } }
/// <summary> /// Method that is called to signal start of the Push service. /// </summary> /// <param name="channelGroup"></param> /// <param name="appSecret"></param> public override void OnChannelGroupReady(IChannelGroup channelGroup, string appSecret) { _mutex.Lock(); try { base.OnChannelGroupReady(channelGroup, appSecret); ApplyEnabledState(Enabled); } finally { _mutex.Unlock(); } }