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

index bf7cca0423d4fd040f13621cead82c600e306c58..2f0de030d55d5317009e41d735b73df9ecaa6daa 100644 (file)
@@ -586,16 +586,26 @@ read_dns6 (void *cls)
     }
   {
     char buf[size];
+    ssize_t sret;
 
     addrlen = sizeof (v6);
-    GNUNET_break (size ==
-                 GNUNET_NETWORK_socket_recvfrom (listen_socket6,
-                                                 buf,
-                                                 size,
-                                                 (struct sockaddr *) &v6,
-                                                 &addrlen));
-    handle_request (listen_socket6, &v6, addrlen,
-                   buf, size);
+    sret = GNUNET_NETWORK_socket_recvfrom (listen_socket6,
+                                          buf,
+                                          size,
+                                          (struct sockaddr *) &v6,
+                                          &addrlen);
+    if (0 > sret)
+    {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+                          "recvfrom");
+      return;
+    }
+    GNUNET_break (size == (size_t) sret);
+    handle_request (listen_socket6,
+                   &v6,
+                   addrlen,
+                   buf,
+                   size);
   }
 }