CHANGES | 1 + dht-bootstrap.c | 19 ++++++++++++------- diff --git a/CHANGES b/CHANGES index d54f227682f81da8e8676ac2b88e5e433f4f59cb..69f55643c054824033835b3240c433a6e9668918 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ * Ability to explicitly specify IP addresses to bind to * 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 diff --git a/dht-bootstrap.c b/dht-bootstrap.c index e8c0b2c7bd87dc7bc40359e4f8223af248cf006c..07ac332d8d5befe169585494109d81dfb7ff221d 100644 --- a/dht-bootstrap.c +++ b/dht-bootstrap.c @@ -37,6 +37,12 @@ #include #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 @@ -507,13 +513,12 @@ else 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) {