9 cerr <<
"peer '" << peer.
nickname() <<
"' sees:" << endl;
11 for (
auto pi : peer.
peers()) {
12 cerr <<
"\t" << pi.first <<
" is " << pi.second.nick << endl;
13 for (
auto h : pi.second.headers) {
14 cerr <<
"\t\t" << h.first <<
" = " << h.second << endl;
20 int main(
int argc,
char*argv[])
29 auto pids1 = peer2.
waitfor(
"peer1");
31 auto pids2 = peer1.waitfor(
"peer2");
35 bool found = peer1.isknown(uuid2);
44 cerr <<
"check for death of " << uuid2 <<
" " << countdown << endl;
47 found = peer1.isknown(uuid2);
48 if (!found) {
break; }
const peerset_t & peers()
Return known peers as map from UUID to nickname.
const nickname_t nickname()
Get our nickname.
void dump_peer(zio::Peer &peer)
int main(int argc, char *argv[])
Peer at the network to discover peers and advertise self.
std::vector< uuid_t > waitfor(const nickname_t &nickname, timeout_t timeout=-1)
Wait for a peer of a given nickname to be discovered.