Exemple #1
0
        public LocalGossipNode(GossipNodeConfiguration configuration)
        {
            _configuration = configuration;

            _nodes = new DelegateKeyedCollection<string, TrackedGossipNode>(x => x.Name);
            _random = new Random();

            var codec = new GossipMessageCodec();
            _messagePump = new GossipMessagePump(configuration,
                codec,
                codec);

            _configuration.Logger.Information("Started {Name} at {LocalEndPoint}", configuration.Name, configuration.LocalEndPoint);

            _messagePump.MessageReceived += OnMessageReceived;
            _messagePump.Open(GetRetransmitCount);

            SetAlive();
            _broadcastTimer = new Timer(_ => Broadcast(), null, _configuration.BroadcastFrequency, _configuration.BroadcastFrequency);
        }
        public LocalGossipNode(GossipNodeConfiguration configuration)
        {
            _configuration = configuration;

            _nodes  = new DelegateKeyedCollection <string, TrackedGossipNode>(x => x.Name);
            _random = new Random();

            var codec = new GossipMessageCodec();

            _messagePump = new GossipMessagePump(configuration,
                                                 codec,
                                                 codec);

            _configuration.Logger.Information("Started {Name} at {LocalEndPoint}", configuration.Name, configuration.LocalEndPoint);

            _messagePump.MessageReceived += OnMessageReceived;
            _messagePump.Open(GetRetransmitCount);

            SetAlive();
            _broadcastTimer = new Timer(_ => Broadcast(), null, _configuration.BroadcastFrequency, _configuration.BroadcastFrequency);
        }