]> git.rkrishnan.org Git - pihpsdr.git/commitdiff
rigctl tcp server: better connection error handling
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Mon, 27 Nov 2023 17:51:03 +0000 (23:21 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Mon, 27 Nov 2023 17:51:03 +0000 (23:21 +0530)
rigctl.c

index 75ab172d8568a2b689984bc87fc80a97f2797b77..087ea926fe9b31004f4ea7465825c6bd3ab04ff2 100644 (file)
--- 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;
        }
     }