+void topology_cb (void *cls,
+ const struct GNUNET_PeerIdentity *first,
+ const struct GNUNET_PeerIdentity *second,
+ struct GNUNET_TIME_Relative latency,
+ uint32_t distance,
+ const char *emsg)
+{
+ FILE *outfile;
+ outfile = cls;
+ if (first != NULL)
+ {
+ if (outfile == NULL)
+ fprintf(stderr, "Peer %s connected to %s\n", GNUNET_i2s(first), GNUNET_h2s(&second->hashPubKey));
+ else
+ {
+ fprintf(outfile, "\t\"%s\" -- ", GNUNET_i2s(first));
+ fprintf(outfile, "\"%s\";\n", GNUNET_i2s(second));
+ }
+ }
+ else
+ {
+ fprintf(stderr, "Finished iterating over topology!\n");
+ if (outfile != NULL)
+ {
+ fprintf(outfile, "}\n");
+ fclose(outfile);
+ }
+ GNUNET_SCHEDULER_add_now (sched, &finish_testing, NULL);
+ }
+}
+