From 129acbde33fabe27cf08b200de5dc9b88816cb89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Sun, 18 Apr 2021 15:22:58 +0200 Subject: [PATCH] Log the number of send iterations of a client --- endlessh.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/endlessh.c b/endlessh.c index 63dafb6..fd11696 100644 --- a/endlessh.c +++ b/endlessh.c @@ -119,6 +119,7 @@ struct client { unsigned long long connect_time; unsigned long long send_next; unsigned long long bytes_sent; + unsigned long send_iter; struct client *next; int port; int fd; @@ -133,6 +134,7 @@ client_new(int fd, unsigned long long send_next) c->connect_time = epochms(); c->send_next = send_next; c->bytes_sent = 0; + c->send_iter = 0; c->next = 0; c->fd = fd; c->port = 0; @@ -173,10 +175,11 @@ client_destroy(struct client *client) unsigned long long dt = epochms() - client->connect_time; logmsg(log_info, "CLOSE host=%s port=%d fd=%d " - "time=%llu.%03llu bytes=%llu", + "time=%llu.%03llu bytes=%llu iter=%lu", client->ipaddr, client->port, client->fd, dt / 1000, dt % 1000, - client->bytes_sent); + client->bytes_sent, + client->send_iter); statistics.milliseconds += dt; close(client->fd); free(client); @@ -647,6 +650,7 @@ sendline(struct client *client, int max_line_length, unsigned long *rng) } } else { client->bytes_sent += out; + client->send_iter++; statistics.bytes_sent += out; return client; }