handle error properly, do not just log but continue gracefully
authorChristian Grothoff <christian@grothoff.org>
Sat, 6 Jan 2018 20:36:15 +0000 (21:36 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sat, 6 Jan 2018 20:36:15 +0000 (21:36 +0100)
src/gns/gnunet-dns2gns.c

index 424677d14de1cc0b113b8c988a3e1ddb1f2d9015..bf7cca0423d4fd040f13621cead82c600e306c58 100644 (file)
@@ -533,14 +533,21 @@ read_dns4 (void *cls)
     }
   {
     char buf[size + 1];
+    ssize_t sret;
 
     addrlen = sizeof (v4);
-    GNUNET_break (size ==
-                 GNUNET_NETWORK_socket_recvfrom (listen_socket4,
-                                                 buf,
-                                                 size + 1,
-                                                 (struct sockaddr *) &v4,
-                                                 &addrlen));
+    sret = GNUNET_NETWORK_socket_recvfrom (listen_socket4,
+                                          buf,
+                                          size + 1,
+                                          (struct sockaddr *) &v4,
+                                          &addrlen);
+    if (0 > sret)
+    {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+                          "recvfrom");
+      return;
+    }
+    GNUNET_break (size == (size_t) sret);
     handle_request (listen_socket4,
                    &v4,
                    addrlen,