gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6885 - in GNUnet: . src/applications/datastore src/applica


From: gnunet
Subject: [GNUnet-SVN] r6885 - in GNUnet: . src/applications/datastore src/applications/dht/module src/applications/dht/tools src/applications/dstore_sqlite src/applications/fs/ecrs src/applications/fs/fsui src/applications/fs/namespace src/include src/util/network_client
Date: Sun, 25 May 2008 21:25:17 -0600 (MDT)

Author: grothoff
Date: 2008-05-25 21:25:16 -0600 (Sun, 25 May 2008)
New Revision: 6885

Modified:
   GNUnet/src/applications/datastore/datastore.c
   GNUnet/src/applications/dht/module/cs.c
   GNUnet/src/applications/dht/module/routing.c
   GNUnet/src/applications/dht/tools/dht_api.c
   GNUnet/src/applications/dht/tools/dht_loopback_test.c
   GNUnet/src/applications/dht/tools/dht_multipeer_test.c
   GNUnet/src/applications/dht/tools/dht_twopeer_test.c
   GNUnet/src/applications/dstore_sqlite/dstore_quota_test.c
   GNUnet/src/applications/dstore_sqlite/dstore_test.c
   GNUnet/src/applications/fs/ecrs/ecrstest.c
   GNUnet/src/applications/fs/ecrs/updowntest.c
   GNUnet/src/applications/fs/fsui/download.c
   GNUnet/src/applications/fs/fsui/fsui.c
   GNUnet/src/applications/fs/namespace/names.c
   GNUnet/src/include/gnunet_dht_lib.h
   GNUnet/src/include/gnunet_fsui_lib.h
   GNUnet/src/include/gnunet_namespace_lib.h
   GNUnet/src/util/network_client/tcpio.c
   GNUnet/todo
Log:
indentation and whitespace removal

Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c       2008-05-26 03:14:41 UTC 
(rev 6884)
+++ GNUnet/src/applications/datastore/datastore.c       2008-05-26 03:25:16 UTC 
(rev 6885)
@@ -281,7 +281,7 @@
       (minPriority >= ntohl (value->priority) + comp_prio))
     {
       /* new content either does not fit (for sure)
-         or has such a low priority that we should 
+         or has such a low priority that we should
          not even bother! */
       GNUNET_mutex_unlock (lock);
       return GNUNET_NO;

Modified: GNUnet/src/applications/dht/module/cs.c
===================================================================
--- GNUnet/src/applications/dht/module/cs.c     2008-05-26 03:14:41 UTC (rev 
6884)
+++ GNUnet/src/applications/dht/module/cs.c     2008-05-26 03:25:16 UTC (rev 
6885)
@@ -32,7 +32,7 @@
 #include "dht.h"
 #include "gnunet_dht_service.h"
 
-#define DEBUG_CS GNUNET_NO
+#define DEBUG_CS GNUNET_YES
 
 /**
  * Global core API.
@@ -116,7 +116,7 @@
   msg = GNUNET_malloc (n);
   msg->header.size = htons (n);
   msg->header.type = htons (GNUNET_CS_PROTO_DHT_REQUEST_PUT);
-  msg->type = htonl(type);
+  msg->type = htonl (type);
   msg->key = *key;
   memcpy (&msg[1], value, size);
 #if DEBUG_CS

Modified: GNUnet/src/applications/dht/module/routing.c
===================================================================
--- GNUnet/src/applications/dht/module/routing.c        2008-05-26 03:14:41 UTC 
(rev 6884)
+++ GNUnet/src/applications/dht/module/routing.c        2008-05-26 03:25:16 UTC 
(rev 6885)
@@ -35,7 +35,7 @@
 #include "gnunet_core.h"
 #include "gnunet_stats_service.h"
 
-#define DEBUG_ROUTING GNUNET_NO
+#define DEBUG_ROUTING GNUNET_YES
 
 /**
  * What is the request priority for DHT operations?

Modified: GNUnet/src/applications/dht/tools/dht_api.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_api.c 2008-05-26 03:14:41 UTC (rev 
6884)
+++ GNUnet/src/applications/dht/tools/dht_api.c 2008-05-26 03:25:16 UTC (rev 
6885)
@@ -100,8 +100,8 @@
       size = ntohs (reply->size) - sizeof (CS_dht_request_put_MESSAGE);
       put = (CS_dht_request_put_MESSAGE *) reply;
       if ((info->processor != NULL) &&
-          (GNUNET_OK != info->processor (&put->key, 
-                                        ntohl(put->type),
+          (GNUNET_OK != info->processor (&put->key,
+                                         ntohl (put->type),
                                          size,
                                          (const char *) &put[1],
                                          info->closure)))
@@ -186,7 +186,7 @@
   GNUNET_thread_join (thread, &unused);
   GNUNET_thread_release_self (info.parent);
   GNUNET_client_connection_destroy (sock);
-  fprintf(stderr, "returning %d\n", info.total);
+  fprintf (stderr, "returning %d\n", info.total);
   return info.total;
 }
 

Modified: GNUnet/src/applications/dht/tools/dht_loopback_test.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_loopback_test.c       2008-05-26 
03:14:41 UTC (rev 6884)
+++ GNUnet/src/applications/dht/tools/dht_loopback_test.c       2008-05-26 
03:25:16 UTC (rev 6885)
@@ -37,27 +37,20 @@
 static int err;
 
 static int
-result_callback(const GNUNET_HashCode * key,
-               unsigned int type,
-               unsigned int size,
-               const char * data,
-               void * cls)
+result_callback (const GNUNET_HashCode * key,
+                 unsigned int type,
+                 unsigned int size, const char *data, void *cls)
 {
-  int * i = cls;
+  int *i = cls;
   char expect[8];
 
 #if 0
-  fprintf(stderr,
-         "Got %u %u `%.*s'\n",
-         type,
-         size,
-         size,
-         data);
+  fprintf (stderr, "Got %u %u `%.*s'\n", type, size, size, data);
 #endif
-  memset(expect, (*i), sizeof(expect));
-  if ( (8 != size) ||
-       (0 != memcmp(expect, data, size) ) ||
-       (type != GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING) )
+  memset (expect, (*i), sizeof (expect));
+  if ((8 != size) ||
+      (0 != memcmp (expect, data, size)) ||
+      (type != GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING))
     {
       err = 1;
       return GNUNET_SYSERR;
@@ -122,7 +115,8 @@
   CHECK (1 == GNUNET_DHT_get (cfg,
                               ectx,
                               GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                              &key, 2 * GNUNET_CRON_SECONDS, &result_callback, 
&i));
+                              &key, 2 * GNUNET_CRON_SECONDS, &result_callback,
+                              &i));
   CHECK (err == 0);
   GNUNET_hash ("key", 3, &key);
   value = GNUNET_malloc (8);
@@ -137,7 +131,8 @@
   CHECK (1 == GNUNET_DHT_get (cfg,
                               ectx,
                               GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                              &key, 2 * GNUNET_CRON_SECONDS, &result_callback, 
&i));
+                              &key, 2 * GNUNET_CRON_SECONDS, &result_callback,
+                              &i));
   GNUNET_hash ("key2", 4, &key);
   CHECK (err == 0);
   left = 10;
@@ -148,7 +143,8 @@
       if (1 == GNUNET_DHT_get (cfg,
                                ectx,
                                GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
-                               &key, 2 * GNUNET_CRON_SECONDS, 
&result_callback, &i))
+                               &key, 2 * GNUNET_CRON_SECONDS,
+                               &result_callback, &i))
         break;
       CHECK (err == 0);
       left--;

Modified: GNUnet/src/applications/dht/tools/dht_multipeer_test.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_multipeer_test.c      2008-05-26 
03:14:41 UTC (rev 6884)
+++ GNUnet/src/applications/dht/tools/dht_multipeer_test.c      2008-05-26 
03:25:16 UTC (rev 6885)
@@ -119,13 +119,12 @@
       /* wait for some DHT's to find each other! */
       sock = GNUNET_client_connection_create (NULL, cfg);
       left = 30;                /* how many iterations should we wait? */
-      printf ("Waiting for peer %u to DHT-connect",
-             i);
+      printf ("Waiting for peer %u to DHT-connect", i);
       while (GNUNET_OK ==
              GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))
         {
-         printf (".");
-         fflush(stdout);
+          printf (".");
+          fflush (stdout);
           sleep (2);
           left--;
           if (left == 0)
@@ -166,7 +165,7 @@
           for (k = 0; k < NUM_ROUNDS; k++)
             {
               printf (".");
-             fflush(stdout);
+              fflush (stdout);
               if (0 < GNUNET_DHT_get (cfg,
                                       ectx,
                                       GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,

Modified: GNUnet/src/applications/dht/tools/dht_twopeer_test.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_twopeer_test.c        2008-05-26 
03:14:41 UTC (rev 6884)
+++ GNUnet/src/applications/dht/tools/dht_twopeer_test.c        2008-05-26 
03:25:16 UTC (rev 6885)
@@ -97,12 +97,12 @@
   /* wait for DHT's to find each other! */
   sock = GNUNET_client_connection_create (NULL, cfg);
   left = 10;                    /* how many iterations should we wait? */
-  printf ("Waiting for peers to DHT-connect (1->2)");  
+  printf ("Waiting for peers to DHT-connect (1->2)");
   while (GNUNET_OK ==
          GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))
     {
       printf (".");
-      fflush(stdout);
+      fflush (stdout);
       sleep (2);
       left--;
       if (left == 0)
@@ -127,12 +127,12 @@
   ok = 0;
   sock = GNUNET_client_connection_create (NULL, cfg);
   left = 10;                    /* how many iterations should we wait? */
-  printf ("Waiting for peers to DHT-connect (2->1)");  
+  printf ("Waiting for peers to DHT-connect (2->1)");
   while (GNUNET_OK ==
          GNUNET_STATS_get_statistics (NULL, sock, &waitForConnect, NULL))
     {
       printf (".");
-      fflush(stdout);
+      fflush (stdout);
       sleep (2);
       left--;
       if (left == 0)
@@ -178,11 +178,11 @@
                                       8, value));
   GNUNET_hash ("key2", 4, &key);
   left = 10;
-  printf("Getting key 2 from peer 2 (stored at peer 1)");
+  printf ("Getting key 2 from peer 2 (stored at peer 1)");
   do
     {
       printf (".");
-      fflush(stdout);
+      fflush (stdout);
       if (1 == GNUNET_DHT_get (cfg,
                                ectx,
                                GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,
@@ -199,12 +199,12 @@
                                             ectx,
                                             "NETWORK", "HOST",
                                             "localhost:2087");
-  printf("Getting key 1 from peer 1 (stored at peer 2)");
+  printf ("Getting key 1 from peer 1 (stored at peer 2)");
   left = 10;
   do
     {
       printf (".");
-      fflush(stdout);
+      fflush (stdout);
       if (1 == GNUNET_DHT_get (cfg,
                                ectx,
                                GNUNET_ECRS_BLOCKTYPE_DHT_STRING2STRING,

Modified: GNUnet/src/applications/dstore_sqlite/dstore_quota_test.c
===================================================================
--- GNUnet/src/applications/dstore_sqlite/dstore_quota_test.c   2008-05-26 
03:14:41 UTC (rev 6884)
+++ GNUnet/src/applications/dstore_sqlite/dstore_quota_test.c   2008-05-26 
03:25:16 UTC (rev 6885)
@@ -89,7 +89,7 @@
   struct GNUNET_GC_Configuration *cfg;
   struct GNUNET_CronManager *cron;
 
-  GNUNET_disable_entropy_gathering();
+  GNUNET_disable_entropy_gathering ();
   cfg = GNUNET_GC_create ();
   if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
     {

Modified: GNUnet/src/applications/dstore_sqlite/dstore_test.c
===================================================================
--- GNUnet/src/applications/dstore_sqlite/dstore_test.c 2008-05-26 03:14:41 UTC 
(rev 6884)
+++ GNUnet/src/applications/dstore_sqlite/dstore_test.c 2008-05-26 03:25:16 UTC 
(rev 6885)
@@ -94,7 +94,7 @@
   struct GNUNET_GC_Configuration *cfg;
   struct GNUNET_CronManager *cron;
 
-  GNUNET_disable_entropy_gathering();
+  GNUNET_disable_entropy_gathering ();
   cfg = GNUNET_GC_create ();
   if (-1 == GNUNET_GC_parse_configuration (cfg, "check.conf"))
     {

Modified: GNUnet/src/applications/fs/ecrs/ecrstest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/ecrstest.c  2008-05-26 03:14:41 UTC (rev 
6884)
+++ GNUnet/src/applications/fs/ecrs/ecrstest.c  2008-05-26 03:25:16 UTC (rev 
6885)
@@ -82,7 +82,7 @@
   if (fd == -1)
     {
       GNUNET_free (name);
-      return GNUNET_SYSERR;
+      return NULL;
     }
   buf = GNUNET_malloc (size);
   memset (buf, size + size / 253, size);

Modified: GNUnet/src/applications/fs/ecrs/updowntest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/updowntest.c        2008-05-26 03:14:41 UTC 
(rev 6884)
+++ GNUnet/src/applications/fs/ecrs/updowntest.c        2008-05-26 03:25:16 UTC 
(rev 6885)
@@ -71,7 +71,7 @@
   if (fd == -1)
     {
       GNUNET_free (name);
-      return GNUNET_SYSERR;
+      return NULL;
     }
   buf = GNUNET_malloc (size);
   memset (buf, size + size / 253, size);

Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c  2008-05-26 03:14:41 UTC (rev 
6884)
+++ GNUnet/src/applications/fs/fsui/download.c  2008-05-26 03:25:16 UTC (rev 
6885)
@@ -280,8 +280,8 @@
   if ((lastBlockOffset == 0) && (dl->is_directory == GNUNET_SYSERR))
     {
       /* check if this is a directory */
-      if ((dl->filename[strlen(dl->filename)-1] == '/') &&
-         (lastBlockSize > strlen (GNUNET_DIRECTORY_MAGIC)) &&
+      if ((dl->filename[strlen (dl->filename) - 1] == '/') &&
+          (lastBlockSize > strlen (GNUNET_DIRECTORY_MAGIC)) &&
           (0 == strncmp (GNUNET_DIRECTORY_MAGIC,
                          lastBlock, strlen (GNUNET_DIRECTORY_MAGIC))))
         dl->is_directory = GNUNET_YES;
@@ -509,22 +509,22 @@
       list->handle = NULL;
       list->ctx->activeDownloadThreads--;
       if (list->state == GNUNET_FSUI_COMPLETED)
-       {
-         /* generate event */
-         event.type = GNUNET_FSUI_download_completed;
-         event.data.DownloadCompleted.dc.pos = list;
-         event.data.DownloadCompleted.dc.cctx = list->cctx;
-         event.data.DownloadCompleted.dc.ppos =
-           list->parent == &list->ctx->activeDownloads ? NULL : list->parent;
-         event.data.DownloadCompleted.dc.pcctx = list->parent->cctx;
-         event.data.DownloadCompleted.dc.spos = list->search;
-         event.data.DownloadCompleted.dc.sctx =
-           list->search == NULL ? NULL : list->search->cctx;
-         event.data.DownloadCompleted.total = list->total;
-         event.data.DownloadCompleted.filename = list->filename;
-         event.data.DownloadCompleted.uri = list->fi.uri;
-         list->ctx->ecb (list->ctx->ecbClosure, &event);
-       }
+        {
+          /* generate event */
+          event.type = GNUNET_FSUI_download_completed;
+          event.data.DownloadCompleted.dc.pos = list;
+          event.data.DownloadCompleted.dc.cctx = list->cctx;
+          event.data.DownloadCompleted.dc.ppos =
+            list->parent == &list->ctx->activeDownloads ? NULL : list->parent;
+          event.data.DownloadCompleted.dc.pcctx = list->parent->cctx;
+          event.data.DownloadCompleted.dc.spos = list->search;
+          event.data.DownloadCompleted.dc.sctx =
+            list->search == NULL ? NULL : list->search->cctx;
+          event.data.DownloadCompleted.total = list->total;
+          event.data.DownloadCompleted.filename = list->filename;
+          event.data.DownloadCompleted.uri = list->fi.uri;
+          list->ctx->ecb (list->ctx->ecbClosure, &event);
+        }
       list->state++;            /* adds _JOINED */
       ret = GNUNET_YES;
     }

Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c      2008-05-26 03:14:41 UTC (rev 
6884)
+++ GNUnet/src/applications/fs/fsui/fsui.c      2008-05-26 03:25:16 UTC (rev 
6885)
@@ -336,9 +336,9 @@
   unsigned int valid;
   unsigned int i;
   GNUNET_ECRS_FileInfo *fis;
-  int * av_ranks;
-  unsigned int * av_certs;
-  unsigned int * ap_ranks;
+  int *av_ranks;
+  unsigned int *av_certs;
+  unsigned int *ap_ranks;
   char *fn;
   char *gh;
   unsigned long long size;
@@ -413,21 +413,21 @@
       if (valid > 0)
         {
           fis = GNUNET_malloc (sizeof (GNUNET_ECRS_FileInfo) * valid);
-         av_ranks = GNUNET_malloc (sizeof (int) * valid);
-         av_certs = GNUNET_malloc (sizeof (unsigned int) * valid);
-         ap_ranks = GNUNET_malloc (sizeof (unsigned int) * valid);
+          av_ranks = GNUNET_malloc (sizeof (int) * valid);
+          av_certs = GNUNET_malloc (sizeof (unsigned int) * valid);
+          ap_ranks = GNUNET_malloc (sizeof (unsigned int) * valid);
           pos = list->resultsReceived;
           i = 0;
           while (pos != NULL)
             {
               if (pos->mandatoryMatchesRemaining == 0)
-               {
-                 fis[i] = pos->fi;
-                 av_ranks[i] = pos->probeSuccess - pos->probeFailure;
-                 av_certs[i] = pos->probeSuccess + pos->probeFailure;
-                 ap_ranks[i] = pos->matchingSearchCount;
-                 i++;
-               }
+                {
+                  fis[i] = pos->fi;
+                  av_ranks[i] = pos->probeSuccess - pos->probeFailure;
+                  av_certs[i] = pos->probeSuccess + pos->probeFailure;
+                  ap_ranks[i] = pos->matchingSearchCount;
+                  i++;
+                }
               pos = pos->next;
             }
         }

Modified: GNUnet/src/applications/fs/namespace/names.c
===================================================================
--- GNUnet/src/applications/fs/namespace/names.c        2008-05-26 03:14:41 UTC 
(rev 6884)
+++ GNUnet/src/applications/fs/namespace/names.c        2008-05-26 03:25:16 UTC 
(rev 6885)
@@ -35,7 +35,7 @@
 
 /**
  * Return the unique, human readable name for the given namespace.
- * 
+ *
  * @return NULL on failure (should never happen)
  */
 char *

Modified: GNUnet/src/include/gnunet_dht_lib.h
===================================================================
--- GNUnet/src/include/gnunet_dht_lib.h 2008-05-26 03:14:41 UTC (rev 6884)
+++ GNUnet/src/include/gnunet_dht_lib.h 2008-05-26 03:25:16 UTC (rev 6885)
@@ -21,6 +21,11 @@
 /**
  * @file include/gnunet_dht_lib.h
  * @brief convenience API to the DHT infrastructure for use by clients
+ *        This API is synchronous and ugly (each get operation creates
+ *        a thread and a client connection to gnunetd).  If this code
+ *        if ever used by more than a testcase, the API should be
+ *        made asynchronous.
+ *
  * @author Christian Grothoff
  */
 

Modified: GNUnet/src/include/gnunet_fsui_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fsui_lib.h        2008-05-26 03:14:41 UTC (rev 
6884)
+++ GNUnet/src/include/gnunet_fsui_lib.h        2008-05-26 03:25:16 UTC (rev 
6885)
@@ -362,20 +362,20 @@
        * Updated availability rank (negative:
        * unavailable, positive: available)
        */
-      int * availability_rank;
+      int *availability_rank;
 
       /**
-       * On how many total queries is the given 
+       * On how many total queries is the given
        * availability rank based?
        */
-      unsigned int * availability_certainty;
+      unsigned int *availability_certainty;
 
       /**
        * Updated applicability rank (the larger,
        * the better the result fits the search
        * criteria).
        */
-      unsigned int * applicability_rank;
+      unsigned int *applicability_rank;
 
       /**
        * Size of the fis, availability and
@@ -446,7 +446,7 @@
       int availability_rank;
 
       /**
-       * On how many total queries is the given 
+       * On how many total queries is the given
        * availability rank based?
        */
       unsigned int availability_certainty;

Modified: GNUnet/src/include/gnunet_namespace_lib.h
===================================================================
--- GNUnet/src/include/gnunet_namespace_lib.h   2008-05-26 03:14:41 UTC (rev 
6884)
+++ GNUnet/src/include/gnunet_namespace_lib.h   2008-05-26 03:25:16 UTC (rev 
6885)
@@ -211,7 +211,7 @@
 
 /**
  * Return the unique, human readable name for the given namespace.
- * 
+ *
  * @return NULL on failure (should never happen)
  */
 char *GNUNET_NS_nsid_to_name (struct GNUNET_GE_Context *ectx,

Modified: GNUnet/src/util/network_client/tcpio.c
===================================================================
--- GNUnet/src/util/network_client/tcpio.c      2008-05-26 03:14:41 UTC (rev 
6884)
+++ GNUnet/src/util/network_client/tcpio.c      2008-05-26 03:25:16 UTC (rev 
6885)
@@ -264,74 +264,75 @@
     return GNUNET_SYSERR;
   af_index = -1;
   /* loop over all possible address families */
-  while (1) 
+  while (1)
     {
       if (addr_families[++af_index] == -1)
-       return GNUNET_SYSERR;      
+        return GNUNET_SYSERR;
       soaddr = NULL;
       socklen = 0;
       if (GNUNET_SYSERR ==
-         GNUNET_get_ip_from_hostname (sock->ectx, host, 
addr_families[af_index], &soaddr,
-                                      &socklen))
-       {
-         GNUNET_free (host);
-         continue;
-       }
+          GNUNET_get_ip_from_hostname (sock->ectx, host,
+                                       addr_families[af_index], &soaddr,
+                                       &socklen))
+        {
+          GNUNET_free (host);
+          continue;
+        }
       GNUNET_mutex_lock (sock->destroylock);
       if (sock->sock != NULL)
-       {
-         GNUNET_free (host);
-         GNUNET_mutex_unlock (sock->destroylock);
-         GNUNET_free (soaddr);
-         return GNUNET_OK;
-       }
+        {
+          GNUNET_free (host);
+          GNUNET_mutex_unlock (sock->destroylock);
+          GNUNET_free (soaddr);
+          return GNUNET_OK;
+        }
       if (sock->dead == GNUNET_YES)
-       {
-         GNUNET_free (host);
-         GNUNET_mutex_unlock (sock->destroylock);
-         GNUNET_free (soaddr);
-         return GNUNET_SYSERR;
-       }
+        {
+          GNUNET_free (host);
+          GNUNET_mutex_unlock (sock->destroylock);
+          GNUNET_free (soaddr);
+          return GNUNET_SYSERR;
+        }
       if (soaddr->sa_family == AF_INET)
-       {
-         ((struct sockaddr_in *) soaddr)->sin_port = htons (port);
-         osock = SOCKET (PF_INET, SOCK_STREAM, 0);
-       }
+        {
+          ((struct sockaddr_in *) soaddr)->sin_port = htons (port);
+          osock = SOCKET (PF_INET, SOCK_STREAM, 0);
+        }
       else
-       {
-         ((struct sockaddr_in6 *) soaddr)->sin6_port = htons (port);
-         osock = SOCKET (PF_INET6, SOCK_STREAM, 0);
-       }
+        {
+          ((struct sockaddr_in6 *) soaddr)->sin6_port = htons (port);
+          osock = SOCKET (PF_INET6, SOCK_STREAM, 0);
+        }
       if (osock == -1)
-       {
-         GNUNET_GE_LOG_STRERROR (sock->ectx,
-                                 GNUNET_GE_ERROR | GNUNET_GE_USER |
-                                 GNUNET_GE_ADMIN | GNUNET_GE_BULK, "socket");
-         GNUNET_free (host);
-         GNUNET_mutex_unlock (sock->destroylock);
-         GNUNET_free (soaddr);
-         continue;
-       }
+        {
+          GNUNET_GE_LOG_STRERROR (sock->ectx,
+                                  GNUNET_GE_ERROR | GNUNET_GE_USER |
+                                  GNUNET_GE_ADMIN | GNUNET_GE_BULK, "socket");
+          GNUNET_free (host);
+          GNUNET_mutex_unlock (sock->destroylock);
+          GNUNET_free (soaddr);
+          continue;
+        }
       sock->sock = GNUNET_socket_create (sock->ectx, NULL, osock);
       GNUNET_socket_set_blocking (sock->sock, GNUNET_NO);
       ret = CONNECT (osock, soaddr, socklen);
       GNUNET_free (soaddr);
       if ((ret != 0) && (errno != EINPROGRESS) && (errno != EWOULDBLOCK))
-       {
-         GNUNET_GE_LOG (sock->ectx,
-                        GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
-                        _("Cannot connect to %s:%u: %s\n"),
-                        host, port, STRERROR (errno));
-         GNUNET_socket_destroy (sock->sock);
-         sock->sock = NULL;
-         GNUNET_free (host);
-         GNUNET_mutex_unlock (sock->destroylock);
-         continue;
-       }
+        {
+          GNUNET_GE_LOG (sock->ectx,
+                         GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
+                         _("Cannot connect to %s:%u: %s\n"),
+                         host, port, STRERROR (errno));
+          GNUNET_socket_destroy (sock->sock);
+          sock->sock = NULL;
+          GNUNET_free (host);
+          GNUNET_mutex_unlock (sock->destroylock);
+          continue;
+        }
       /* we call select() first with a timeout of WAIT_SECONDS to
-        avoid blocking on a later write indefinitely;
-        Important if a local firewall decides to just drop
-        the TCP handshake... */
+         avoid blocking on a later write indefinitely;
+         Important if a local firewall decides to just drop
+         the TCP handshake... */
       FD_ZERO (&rset);
       FD_ZERO (&wset);
       FD_ZERO (&eset);
@@ -343,40 +344,40 @@
       errno = 0;
       ret = SELECT (osock + 1, &rset, &wset, &eset, &timeout);
       if (ret == -1)
-       {
-         if (errno != EINTR)
-           GNUNET_GE_LOG_STRERROR (sock->ectx,
-                                   GNUNET_GE_WARNING | GNUNET_GE_USER |
-                                   GNUNET_GE_BULK, "select");
-         GNUNET_socket_destroy (sock->sock);
-         sock->sock = NULL;
-         GNUNET_free (host);
-         GNUNET_mutex_unlock (sock->destroylock);
-         continue;
-       }
+        {
+          if (errno != EINTR)
+            GNUNET_GE_LOG_STRERROR (sock->ectx,
+                                    GNUNET_GE_WARNING | GNUNET_GE_USER |
+                                    GNUNET_GE_BULK, "select");
+          GNUNET_socket_destroy (sock->sock);
+          sock->sock = NULL;
+          GNUNET_free (host);
+          GNUNET_mutex_unlock (sock->destroylock);
+          continue;
+        }
       if (FD_ISSET (osock, &eset))
-       {
-         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_free (host);
-         GNUNET_mutex_unlock (sock->destroylock);
-         continue;
-       }
+        {
+          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_free (host);
+          GNUNET_mutex_unlock (sock->destroylock);
+          continue;
+        }
       if (!FD_ISSET (osock, &wset))
-       {
-         GNUNET_GE_LOG (sock->ectx,
-                        GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
-                        _("Failed to connect to %s:%u in %ds\n"),
-                        host, port, WAIT_SECONDS);
-         GNUNET_socket_destroy (sock->sock);
-         sock->sock = NULL;
-         GNUNET_free (host);
-         GNUNET_mutex_unlock (sock->destroylock);
-         continue;
-       }
+        {
+          GNUNET_GE_LOG (sock->ectx,
+                         GNUNET_GE_WARNING | GNUNET_GE_USER | GNUNET_GE_BULK,
+                         _("Failed to connect to %s:%u in %ds\n"),
+                         host, port, WAIT_SECONDS);
+          GNUNET_socket_destroy (sock->sock);
+          sock->sock = NULL;
+          GNUNET_free (host);
+          GNUNET_mutex_unlock (sock->destroylock);
+          continue;
+        }
       break;
     }
   GNUNET_free (host);

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2008-05-26 03:14:41 UTC (rev 6884)
+++ GNUnet/todo 2008-05-26 03:25:16 UTC (rev 6885)
@@ -23,8 +23,8 @@
 - test RPC code (write a small demo)
 - tune DHT
 - tune GAP query planning code
+- make GET function of DHT client LIB API asynchronous
 
-
 1.0.0 (aka "userfriendly"):
 
 





reply via email to

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