private Task StartSubscriptionLoop(List <Endpoint> previousEndpoints)
 {
     return(Task.Run(async() =>
     {
         while (!_cts.IsCancellationRequested)
         {
             try
             {
                 var currentEndpoints = await _serviceSubscriber.Endpoints(_cts.Token).ConfigureAwait(false);
                 if (!EndpointListsMatch(previousEndpoints, currentEndpoints))
                 {
                     _cache.Set(_id, currentEndpoints);
                     EndpointsChanged?.Invoke(this, EventArgs.Empty);
                     previousEndpoints = currentEndpoints;
                 }
             }
             catch
             {
                 // ignore
             }
         }
     }, _cts.Token));
 }
示例#2
0
 private void ReloadDevices()
 {
     _reloadDevicesBusy.Yield(() => EndpointsChanged?.Invoke(this, EventArgs.Empty));
 }
示例#3
0
 /// <summary>
 /// Raises the <see cref="EndpointsChanged"/> event.
 /// </summary>
 void OnEndpointsChanged()
 {
     EndpointsChanged?.Invoke(this, EventArgs.Empty);
 }