try to get disconnect to close socket, ah well
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 8 Apr 2021 14:06:34 +0000 (15:06 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 8 Apr 2021 14:06:34 +0000 (15:06 +0100)
small_jtag_test/main.cpp

index ed7a2a644f2cd473395591ad6bda06af913aa629..7859f647da0e7ffef4fa80972332ac91504d1437 100644 (file)
@@ -100,7 +100,12 @@ int read_handler(int fdread, char *buffer)
         case 0:
             return 0; // timeout (nothing read)
         default:
-            return read(fdread, buffer, 1);
+            status = read(fdread, buffer, 1);
+            if (status == -1) {
+                printf("Error reading on socket\n");
+                close(fdread);
+            }
+            return status;
     }
 }