gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7074 - in GNUnet/src: applications/fs/lib util/network_cli


From: gnunet
Subject: [GNUnet-SVN] r7074 - in GNUnet/src: applications/fs/lib util/network_client
Date: Sat, 7 Jun 2008 15:31:20 -0600 (MDT)

Author: grothoff
Date: 2008-06-07 15:31:20 -0600 (Sat, 07 Jun 2008)
New Revision: 7074

Modified:
   GNUnet/src/applications/fs/lib/fslib.c
   GNUnet/src/util/network_client/tcpio.c
Log:
do not report errors for each attempt; faster failure

Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c      2008-06-07 19:14:31 UTC (rev 
7073)
+++ GNUnet/src/applications/fs/lib/fslib.c      2008-06-07 21:31:20 UTC (rev 
7074)
@@ -256,8 +256,8 @@
             {
               GNUNET_thread_sleep (delay);
               delay *= 2;
-              if (delay > 5 * GNUNET_CRON_SECONDS)
-                delay = 5 * GNUNET_CRON_SECONDS;
+              if (delay > 60 * GNUNET_CRON_SECONDS)
+                delay = 60 * GNUNET_CRON_SECONDS;
               if ((GNUNET_OK ==
                    GNUNET_client_connection_ensure_connected (ctx->sock))
                   && (GNUNET_OK == reissue_requests (ctx)))
@@ -339,7 +339,6 @@
 {
   struct GNUNET_FS_SearchHandle *ret;
   CS_fs_request_search_MESSAGE *req;
-  int ok;
 #if DEBUG_FSLIB
   GNUNET_EncName enc;
 #endif
@@ -373,9 +372,10 @@
            "FSLIB passes request %u to daemon (%d)\n",
            ctx->total_requested++, type);
 #endif
-  ok = GNUNET_client_connection_write (ctx->sock, &req->header);
+  if (GNUNET_OK != GNUNET_client_connection_write (ctx->sock, &req->header))
+    GNUNET_client_connection_close_temporarily(ctx->sock);    
   GNUNET_mutex_unlock (ctx->lock);
-  return ok;
+  return GNUNET_OK;
 }
 
 /**

Modified: GNUnet/src/util/network_client/tcpio.c
===================================================================
--- GNUnet/src/util/network_client/tcpio.c      2008-06-07 19:14:31 UTC (rev 
7073)
+++ GNUnet/src/util/network_client/tcpio.c      2008-06-07 21:31:20 UTC (rev 
7074)
@@ -291,8 +291,8 @@
    * few times with a small delay if we may just be having
    * a connection issue.
    */
-#define TRIES_PER_AF 4
-#define DELAY_PER_RETRY (250 * GNUNET_CRON_MILLISECONDS)
+#define TRIES_PER_AF 2
+#define DELAY_PER_RETRY (50 * GNUNET_CRON_MILLISECONDS)
 #define ADVANCE() do { af_index++; tries = TRIES_PER_AF; } while(0)
 #define RETRY() do { tries--; if (tries == 0) { ADVANCE(); } else { 
GNUNET_thread_sleep(DELAY_PER_RETRY); } } while (0)
   tries = TRIES_PER_AF;
@@ -300,7 +300,12 @@
   while (1)
     {
       if (addr_families[af_index] == -1)
-        return GNUNET_SYSERR;
+       {
+          GNUNET_GE_LOG (sock->ectx,
+                         GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
+                         _("Error connecting to %s:%u\n"), host, port);
+         return GNUNET_SYSERR;
+       }
       soaddr = NULL;
       socklen = 0;
       if (GNUNET_SYSERR ==
@@ -402,9 +407,6 @@
         }
       if ((FD_ISSET (osock, &eset)) || (!FD_ISSET (osock, &wset)))
         {
-          GNUNET_GE_LOG (sock->ectx,
-                         GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
-                         _("Error connecting to %s:%u\n"), host, port);
           GNUNET_socket_destroy (sock->sock);
           sock->sock = NULL;
           GNUNET_mutex_unlock (sock->destroylock);
@@ -425,10 +427,6 @@
                                 GNUNET_GE_BULK, "getsockopt");
       if ((soerr != 0) || (ret != 0 && (errno == ENOTSOCK || errno == EBADF)))
         {
-          GNUNET_GE_LOG (sock->ectx,
-                         GNUNET_GE_DEBUG | GNUNET_GE_USER |
-                         GNUNET_GE_BULK,
-                         _("Failed to connect to %s:%u\n"), host, port);
           GNUNET_socket_destroy (sock->sock);
           sock->sock = NULL;
           GNUNET_mutex_unlock (sock->destroylock);





reply via email to

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