do not try TCP if port is 0
authorChristian Grothoff <christian@grothoff.org>
Mon, 24 Jan 2011 11:13:39 +0000 (11:13 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 24 Jan 2011 11:13:39 +0000 (11:13 +0000)
TODO
src/util/client.c

diff --git a/TODO b/TODO
index 9bfea3fd650945a0bb894ac6b3bbb3c5ac97ecbd..afd45f0916854fd75baf71f1078a95a3f8c177ce 100644 (file)
--- a/TODO
+++ b/TODO
@@ -7,6 +7,9 @@
     + implement UDP, HTTP/HTTPS 
 * Transport:
   - UDP fragmentation
+* UTIL / FS:
+  - gnunet-publish tires to connect to service even if
+    run with 'simulation' option (-s)
 * DHT: [Nate]
   - track paths content travels (PUT, reply-to-get) in messages,
     pass to client (client API & protocol already support this!)
index d957dd00a5d4f39c5ef05fe1fe4e0018f2dba1aa..ed554d96c538480dee3987458ff4736a61f76aa4 100644 (file)
@@ -253,6 +253,7 @@ struct GNUNET_CLIENT_Connection
 
 };
 
+
 /**
  * Try to connect to the service.
  *
@@ -272,7 +273,7 @@ do_connect (const char *service_name,
   unsigned long long port;
 
 #if AF_UNIX
-  if (0 == attempt % 2)
+  if (0 == (attempt % 2))
     {
       /* on even rounds, try UNIX */
       if (GNUNET_OK ==
@@ -314,6 +315,27 @@ do_connect (const char *service_name,
                   service_name);
       return NULL;
     }
+  if (port == 0)
+    {
+#if AF_UNIX
+      if (0 != (attempt % 2))
+       {
+         /* try UNIX */
+         if (GNUNET_OK ==
+             GNUNET_CONFIGURATION_get_value_string (cfg,
+                                                    service_name,
+                                                    "UNIXPATH", &unixpath))
+           {
+             sock = GNUNET_CONNECTION_create_from_connect_to_unixpath (cfg,
+                                                                       unixpath);
+             GNUNET_free (unixpath);
+             if (sock != NULL)
+               return sock;
+           }
+       }
+#endif
+      return NULL;
+    }
   sock = GNUNET_CONNECTION_create_from_connect (cfg,
                                                 hostname,
                                                 port);