Esempio n. 1
0
        public Task UnregisterAsync(IBus bus)
        {
            _peerRepository.SetPeerDown(_self.Id, SystemDateTime.UtcNow);
            bus.Publish(new PeerStopped(_self));
            _pingStopwatch.Stop();

            return(Task.CompletedTask);
        }
        private void StopPeer(UnregisterPeerCommand message, PeerDescriptor peer)
        {
            var peerId       = message.PeerId;
            var endPoint     = message.PeerEndPoint ?? peer.Peer.EndPoint;
            var timestampUtc = message.TimestampUtc ?? SystemDateTime.UtcNow;

            if (_peerRepository.SetPeerDown(peerId, timestampUtc))
            {
                _bus.Publish(new PeerStopped(peerId, endPoint, timestampUtc));
            }
        }