gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6983 - in GNUnet/src: applications/dht/tools applications/


From: gnunet
Subject: [GNUnet-SVN] r6983 - in GNUnet/src: applications/dht/tools applications/fs/ecrs util/network_client
Date: Sun, 1 Jun 2008 15:29:40 -0600 (MDT)

Author: grothoff
Date: 2008-06-01 15:29:40 -0600 (Sun, 01 Jun 2008)
New Revision: 6983

Modified:
   GNUnet/src/applications/dht/tools/dht_api.c
   GNUnet/src/applications/fs/ecrs/namespace.c
   GNUnet/src/util/network_client/tcpio.c
Log:
fx

Modified: GNUnet/src/applications/dht/tools/dht_api.c
===================================================================
--- GNUnet/src/applications/dht/tools/dht_api.c 2008-06-01 20:17:50 UTC (rev 
6982)
+++ GNUnet/src/applications/dht/tools/dht_api.c 2008-06-01 21:29:40 UTC (rev 
6983)
@@ -87,17 +87,15 @@
 
   sock = GNUNET_client_connection_create (ectx, cfg);
   if (sock == NULL)
-    {
-      return NULL;
-    }
+    return NULL;   
 
   ctx = GNUNET_malloc (sizeof (struct GNUNET_DHT_Context));
   ctx->sock = sock;
   ctx->closure = resCallbackClosure;
   ctx->processor = resultCallback;
-  ctx->poll_thread = GNUNET_thread_create (&poll_thread, ctx, 1024 * 8);       
 /* Should this be here, or will we create on the first request? */
+  ctx->poll_thread = GNUNET_thread_create (&poll_thread, ctx, 1024 * 8);
   ctx->aborted = GNUNET_NO;
-  return NULL;
+  return ctx;
 }
 
 

Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2008-06-01 20:17:50 UTC (rev 
6982)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2008-06-01 21:29:40 UTC (rev 
6983)
@@ -398,15 +398,16 @@
     }
   dst = GNUNET_malloc (len);
   len = GNUNET_disk_file_read (ectx, fileName, len, dst);
-  GNUNET_free (fileName);
   hke = (GNUNET_RSA_PrivateKeyEncoded *) dst;
   if (ntohs (hke->len) != len)
     {
       GNUNET_GE_LOG (ectx, GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
                      _("Format of pseudonym `%s' is invalid.\n"), fileName);
+      GNUNET_free (fileName);
       GNUNET_free (hke);
       return NULL;
     }
+  GNUNET_free (fileName);
   hk = GNUNET_RSA_decode_key (hke);
   GNUNET_free (hke);
   if (hk == NULL)

Modified: GNUnet/src/util/network_client/tcpio.c
===================================================================
--- GNUnet/src/util/network_client/tcpio.c      2008-06-01 20:17:50 UTC (rev 
6982)
+++ GNUnet/src/util/network_client/tcpio.c      2008-06-01 21:29:40 UTC (rev 
6983)
@@ -250,6 +250,8 @@
   unsigned short port;
   char *host;
   int af_index;
+  int soerr;
+  socklen_t soerrlen;
 
   GNUNET_GE_ASSERT (NULL, sock != NULL);
   if (sock->sock != NULL)
@@ -370,30 +372,27 @@
           GNUNET_mutex_unlock (sock->destroylock);
           continue;
         }
-      else
-        {
-          int soerr = 0;
-          socklen_t soerrlen = sizeof (soerr);
+      soerr = 0;
+      soerrlen = sizeof (soerr);
 
-          ret = GETSOCKOPT (osock, SOL_SOCKET, SO_ERROR, &soerr, &soerrlen);
-          if (ret != 0)
-            GNUNET_GE_LOG_STRERROR (sock->ectx,
-                                    GNUNET_GE_WARNING | GNUNET_GE_USER |
-                                    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);
-              continue;
-            }
-        }
+      ret = GETSOCKOPT (osock, SOL_SOCKET, SO_ERROR, &soerr, &soerrlen);
+      if (ret != 0)
+       GNUNET_GE_LOG_STRERROR (sock->ectx,
+                               GNUNET_GE_WARNING | GNUNET_GE_USER |
+                               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);
+         continue;
+       }    
       break;
     }
   GNUNET_free (host);





reply via email to

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