コード例 #1
0
        public async Task SyncWithAsync(IEnumerable <SwimHost> hosts)
        {
            var messages = new List <SwimMessage>
            {
                new SyncMessage(_membership.Local)
            };

            foreach (var member in _membership.GetAll(includeLocal: false, includeFaulty: true))
            {
                messages.Add(new UpdateMessage(member));
            }

            foreach (var host in hosts)
            {
                await _transport.SendAsync(messages, host);
            }
        }
コード例 #2
0
        public async Task PingAsync(SwimHost host)
        {
            var seq = (ulong)Interlocked.Increment(ref _seq);

            var cts = TimerUtils.SetTimer(() =>
            {
                CleanupSeq(seq);
                PingReqAsync(host);
            }, _options.PingTimeout);

            _seqTimeouts.AddOrUpdate(seq, cts, (_, __) => cts);

            await _transport.SendAsync(new[]
            {
                new PingMessage(seq),
            }, host);
        }