Esempio n. 1
0
        public void Handle(PeerSubscriptionsForTypesUpdated message)
        {
            if (EnqueueIfRegistering(message))
            {
                return;
            }

            var peer = GetPeerCheckTimestamp(message.PeerId, message.TimestampUtc);

            if (peer.Value == null)
            {
                WarnWhenPeerDoesNotExist(peer, message.PeerId);
                return;
            }

            var subscriptionsForTypes = message.SubscriptionsForType ?? Array.Empty <SubscriptionsForType>();

            peer.Value.SetSubscriptionsForType(subscriptionsForTypes, message.TimestampUtc);

            PeerUpdated?.Invoke(message.PeerId, PeerUpdateAction.Updated);

            var observedSubscriptions = GetObservedSubscriptions(subscriptionsForTypes);

            if (observedSubscriptions.Count > 0)
            {
                PeerSubscriptionsUpdated?.Invoke(message.PeerId, observedSubscriptions);
            }
        }
Esempio n. 2
0
        public void Handle(PeerSubscriptionsForTypesUpdated message)
        {
            if (EnqueueIfRegistering(message))
            {
                return;
            }

            var peer = _peers.GetValueOrDefault(message.PeerId);

            if (peer == null)
            {
                return;
            }

            peer.SetSubscriptionsForType(message.SubscriptionsForType ?? Enumerable.Empty <SubscriptionsForType>(), message.TimestampUtc);

            PeerUpdated(message.PeerId, PeerUpdateAction.Updated);
        }
Esempio n. 3
0
        public void Handle(PeerSubscriptionsForTypesUpdated message)
        {
            if (EnqueueIfRegistering(message))
            {
                return;
            }

            var peer = GetPeerCheckTimestamp(message.PeerId, message.TimestampUtc);

            if (peer.Value == null)
            {
                WarnWhenPeerDoesNotExist(peer, message.PeerId);
                return;
            }

            peer.Value.SetSubscriptionsForType(message.SubscriptionsForType ?? Enumerable.Empty <SubscriptionsForType>(), message.TimestampUtc);

            PeerUpdated(message.PeerId, PeerUpdateAction.Updated);
        }