Exemple #1
0
 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);
     }
 }
Exemple #2
0
        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);
        }
Exemple #3
0
        void IManager.Subscribe(Subscriber subscriber)
        {
            _self.repo.Add(subscriber);

            update_subscriber(subscriber);

            trace("proxy.{0} is subscribed", subscriber.Tag);
        }
Exemple #4
0
        void IHostResolver.Subscribe(PubSubHandler onPubSub, string tag)
        {
            var subscriber = new Subscriber
                                 {
                                     OnPubSub = onPubSub,
                                     Tag = tag
                                 };

            subscribe(subscriber);
        }
Exemple #5
0
 private void subscribe(Subscriber subscriber)
 {
     _self.thread.PostAction(
         () => _manager.Subscribe(subscriber));
 }
Exemple #6
0
        void IRepository.Remove(Subscriber subscriber)
        {
            bool wasThere = _subscribers.Remove(subscriber);

            if (wasThere)
                _counters.Discovery_State_ActiveSubscribers--;
        }
Exemple #7
0
 void IRepository.Add(Subscriber subscriber)
 {
     _subscribers.Add(subscriber);
     _counters.Discovery_State_ActiveSubscribers++;
 }