Ejemplo n.º 1
0
        private static async Task <Gossiper> StartGossiper(ushort listenPort, IPEndPoint[] seeds, ILogger logger)
        {
            var options = new GossiperOptions
            {
                SeedMembers = seeds,
            };

            var gossiper = new Gossiper(listenPort, 0x06, listenPort, options, logger);
            await gossiper.StartAsync();

            return(gossiper);
        }
Ejemplo n.º 2
0
        public void Configure(ILogger <Startup> logger, IEnumerable <IMemberListener> memberListeners, IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseDefaultFiles();
            app.UseStaticFiles();
            app.UseSignalR(routes =>
            {
                routes.MapHub <MembersHub>("/membersHub");
            });

            var listenPort = ushort.Parse(_configuration["port"]);
            var options    = new GossiperOptions
            {
                SeedMembers     = GetSeedEndPoints(),
                MemberListeners = memberListeners
            };

            var gossiper = new Gossiper(listenPort, 0x01, (ushort)5000, options, logger);

            gossiper.StartAsync().ConfigureAwait(false);
        }