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); } }
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); }