@GossipUpdate public void exchange(CTRWPeerSampler other) { SamplingMessage m = messages.poll(); if (m.finished()) { other.samplePeer(this); } else { // pass the message along to a neighbor m.update(getDegree()); other.messages.add(m); } }
@ViewUniformRandom public Set<Address> select() { SamplingMessage m = messages.peek(); // next message in the queue if (m == null) return null; // No messages. Do not gossip. else if (m.finished()) { Set<Address> s = new HashSet<Address>(); s.add(m.source); return s; } else { return view; } }