* select() replaced with poll()
* arc4random instead of /dev/urandom reading
* Some simple hardening
+ * Keep statistics in process title (BSD)
20 November 2011: dht-bootstrap-0.2
#define MIN(x, y) ((x) <= (y) ? (x) : (y))
+#ifdef __linux__
+// clang-format off
+void setproctitle_fast(const char *_fmt, ...) {}
+// clang-format on
+#endif
+
static int
send_ping(struct sockaddr *sa, int salen, const unsigned char *tid, int tid_len);
static int
tv_sec = random() % 30;
int tv_msec = random() % 1000;
- if (dht_debug)
- debugf(
- "%d+%d %d+%d\n",
- list_elements(&v4_confirmed),
- list_elements(&v6_confirmed),
- list_elements(&v4_new),
- list_elements(&v6_new));
+ setproctitle_fast(
+ "%d+%d %d+%d",
+ list_elements(&v4_confirmed),
+ list_elements(&v6_confirmed),
+ list_elements(&v4_new),
+ list_elements(&v6_new));
rc = poll(fds, 2, tv_sec * 1000 + tv_msec);
if (rc < 0) {