From: Joseph C. Lehner Date: Thu, 5 Sep 2019 13:43:54 +0000 (+0200) Subject: Don't print each keep-alive request on a new line X-Git-Tag: v0.9.14~7 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d2f5dc2823f38ee19c1467b06d05610947a7ff14;p=oweals%2Fnmrpflash.git Don't print each keep-alive request on a new line --- diff --git a/nmrp.c b/nmrp.c index 4501d63..9d5c5f8 100644 --- a/nmrp.c +++ b/nmrp.c @@ -356,7 +356,7 @@ int nmrp_do(struct nmrpd_args *args) uint16_t region; char *filename; time_t beg; - int i, status, ulreqs, expect, upload_ok, autoip; + int i, status, ulreqs, expect, upload_ok, autoip, kareqs; struct ethsock *sock; struct ethsock_ip_undo *ip_undo = NULL; struct ethsock_arp_undo *arp_undo = NULL; @@ -514,6 +514,7 @@ int nmrp_do(struct nmrpd_args *args) expect = NMRP_C_CONF_REQ; ulreqs = 0; + kareqs = 0; while (!g_interrupted) { if (expect != NMRP_C_NONE && rx.msg.code != expect) { @@ -634,7 +635,7 @@ int nmrp_do(struct nmrpd_args *args) case NMRP_C_KEEP_ALIVE_REQ: tx.msg.code = NMRP_C_KEEP_ALIVE_ACK; ethsock_set_timeout(sock, args->ul_timeout); - printf("Received keep-alive request.\n"); + printf("\rReceived keep-alive request (%d). ", ++kareqs); break; case NMRP_C_CLOSE_REQ: tx.msg.code = NMRP_C_CLOSE_ACK; @@ -660,6 +661,10 @@ int nmrp_do(struct nmrpd_args *args) } if (rx.msg.code == NMRP_C_CLOSE_REQ) { + if (ka_count) { + printf("\n"); + } + printf("Remote finished. Closing connection.\n"); break; }