gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r27955 - gnunet/src/hello


From: gnunet
Subject: [GNUnet-SVN] r27955 - gnunet/src/hello
Date: Fri, 12 Jul 2013 15:28:01 +0200

Author: wachs
Date: 2013-07-12 15:28:01 +0200 (Fri, 12 Jul 2013)
New Revision: 27955

Modified:
   gnunet/src/hello/hello.c
Log:
automatically replace all server addresses with client addresses


Modified: gnunet/src/hello/hello.c
===================================================================
--- gnunet/src/hello/hello.c    2013-07-12 13:04:38 UTC (rev 27954)
+++ gnunet/src/hello/hello.c    2013-07-12 13:28:01 UTC (rev 27955)
@@ -811,7 +811,10 @@
   const char *addr;
   char *uri_addr;
   char *ret;
+  char *addr_dup;
+  char *pos;
   char tbuf[16] = "";
+  char *client_str = "_client";
   struct tm *t;
   time_t seconds;
 
@@ -829,11 +832,18 @@
     return GNUNET_OK;
   }
   addr = papi->address_to_string (papi->cls, address->address, 
address->address_length);
+
   if ( (addr == NULL) || (strlen(addr) == 0) )
     return GNUNET_OK;
+
+  addr_dup = GNUNET_strdup (addr);
+  if (NULL != (pos = strstr (addr_dup, "_server")))
+       memcpy (pos, client_str, strlen(client_str)); /* Replace all server 
addresses with client addresses */
+
    /* For URIs we use '(' and ')' instead of '[' and ']' as brackets are 
reserved
       characters in URIs */
-  uri_addr = map_characters (addr, "[]", "()");
+  uri_addr = map_characters (addr_dup, "[]", "()");
+  GNUNET_free (addr_dup);
   seconds = expiration.abs_value / 1000;
   t = gmtime (&seconds);
 




reply via email to

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