From 76532b13356c8390f920dc31c7f91b0b20fc3a1b Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Mon, 27 Nov 2023 23:21:03 +0530 Subject: [PATCH] rigctl tcp server: better connection error handling --- rigctl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rigctl.c b/rigctl.c index 75ab172..087ea92 100644 --- a/rigctl.c +++ b/rigctl.c @@ -913,9 +913,13 @@ static gpointer rigctl_client(gpointer data) { command_index = 0; } } - } else if (numbytes <= 0) { + } else if (numbytes == 0) { // print the errno string - perror("RIGCTL server: got zero bytes from the client"); + perror("RIGCTL server: connection closed by the client"); + break; + } else if (numbytes == -1) { + perror("RIGCTL server: error reading from the client"); + break; } } -- 2.45.2