gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r11497 - gnunet/src/util


From: gnunet
Subject: [GNUnet-SVN] r11497 - gnunet/src/util
Date: Tue, 25 May 2010 17:47:41 +0200

Author: grothoff
Date: 2010-05-25 17:47:40 +0200 (Tue, 25 May 2010)
New Revision: 11497

Modified:
   gnunet/src/util/connection.c
Log:
handle errors better

Modified: gnunet/src/util/connection.c
===================================================================
--- gnunet/src/util/connection.c        2010-05-25 15:46:46 UTC (rev 11496)
+++ gnunet/src/util/connection.c        2010-05-25 15:47:40 UTC (rev 11497)
@@ -290,7 +290,7 @@
    * termination as a signal (because only then will the leaked
    * socket be freed!)
    */
-  int persist;
+  int16_t persist;
 
 };
 
@@ -1345,6 +1345,13 @@
 {
   GNUNET_CONNECTION_TransmitReadyNotify notify;
 
+  if (NULL != sock->sock)
+    {
+      GNUNET_NETWORK_socket_shutdown (sock->sock, SHUT_RDWR);
+      GNUNET_break (GNUNET_OK ==
+                   GNUNET_NETWORK_socket_close (sock->sock));
+      sock->sock = NULL;
+    }
   if (sock->nth.notify_ready == NULL)
     return;                     /* nobody to tell about it */
   notify = sock->nth.notify_ready;
@@ -1418,13 +1425,6 @@
                   ("Could not satisfy pending transmission request, socket 
closed or connect failed (%p).\n"),
                   sock);
 #endif
-      if (NULL != sock->sock)
-        {
-          GNUNET_NETWORK_socket_shutdown (sock->sock, SHUT_RDWR);
-          GNUNET_break (GNUNET_OK ==
-                        GNUNET_NETWORK_socket_close (sock->sock));
-          sock->sock = NULL;
-        }
       transmit_error (sock);
       return;                   /* connect failed for good, we're finished */
     }
@@ -1448,10 +1448,17 @@
     {
       if (errno == EINTR)
         goto RETRY;
+#if 0
+      int en = errno;
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                 _("Failed to send to `%s': %s\n"),
+                 GNUNET_a2s (sock->addr,
+                             sock->addrlen),
+                 STRERROR (en));
+#endif
 #if DEBUG_CONNECTION
       GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "send");
 #endif
-      GNUNET_NETWORK_socket_shutdown (sock->sock, SHUT_WR);
       transmit_error (sock);
       return;
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]