private void fire_notification(Subscriber subscriber, string callbackUri, string role, bool alive) { try { subscriber.OnPubSub(callbackUri, role, alive); } catch (Exception ex) { warn(ex, "Failed while notifying proxy.{0}", subscriber.Tag); } }
private void update_subscriber(Subscriber subscriber) { var peers = _self.repo.GetPeers(); int count = peers.Length; foreach (var peer in peers) { fire_notification(subscriber, peer.CallbackUri, peer.Role, true); } _counters.Discovery_Event_HelloNotificationsProduced += count; trace("{0} hello notifications are generated", count); }
void IManager.Subscribe(Subscriber subscriber) { _self.repo.Add(subscriber); update_subscriber(subscriber); trace("proxy.{0} is subscribed", subscriber.Tag); }
void IHostResolver.Subscribe(PubSubHandler onPubSub, string tag) { var subscriber = new Subscriber { OnPubSub = onPubSub, Tag = tag }; subscribe(subscriber); }
private void subscribe(Subscriber subscriber) { _self.thread.PostAction( () => _manager.Subscribe(subscriber)); }
void IRepository.Remove(Subscriber subscriber) { bool wasThere = _subscribers.Remove(subscriber); if (wasThere) _counters.Discovery_State_ActiveSubscribers--; }
void IRepository.Add(Subscriber subscriber) { _subscribers.Add(subscriber); _counters.Discovery_State_ActiveSubscribers++; }