even longer timeout, still timing out on hostkey generation (sparcbot)
[oweals/gnunet.git] / src / hostlist / test_gnunet_daemon_hostlist_learning.c
index 684df0f4e36961b920232be542ae6f28e1c98863..43199bd91e571b002fd99653ca40949546d1175d 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -288,10 +288,8 @@ static int ad_arrive_handler (void *cls,
                              uint32_t distance)
 {
   char *hostname;
                              uint32_t distance)
 {
   char *hostname;
-  char *expected_uri = GNUNET_malloc (MAX_URL_LEN);
-
+  char *expected_uri;
   unsigned long long port;
   unsigned long long port;
-  size_t size;
   const struct GNUNET_MessageHeader * incoming;
 
   if (-1 == GNUNET_CONFIGURATION_get_value_number (adv_peer.cfg,
   const struct GNUNET_MessageHeader * incoming;
 
   if (-1 == GNUNET_CONFIGURATION_get_value_number (adv_peer.cfg,
@@ -299,10 +297,9 @@ static int ad_arrive_handler (void *cls,
                                                    "HTTPPORT",
                                                    &port))
     {
                                                    "HTTPPORT",
                                                    &port))
     {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Could not read advertising server's configuration\n" );
-    if ( NULL != expected_uri ) GNUNET_free ( expected_uri );
-    return GNUNET_SYSERR;
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                 "Could not read advertising server's configuration\n" );
+      return GNUNET_SYSERR;
     }
 
   if ( GNUNET_SYSERR  == GNUNET_CONFIGURATION_get_value_string (adv_peer.cfg,
     }
 
   if ( GNUNET_SYSERR  == GNUNET_CONFIGURATION_get_value_string (adv_peer.cfg,
@@ -311,35 +308,23 @@ static int ad_arrive_handler (void *cls,
                                                    &hostname))
     hostname = GNUNET_RESOLVER_local_fqdn_get ();
 
                                                    &hostname))
     hostname = GNUNET_RESOLVER_local_fqdn_get ();
 
-  if (NULL != hostname)
-    {
-      size = strlen (hostname);
-      if (size + 15 > MAX_URL_LEN)
-        {
-          GNUNET_break (0);
-        }
-      else
-        {
-          GNUNET_asprintf (&expected_uri,
-                           "http://%s:%u/",
-                           hostname,
-                           (unsigned int) port);
-        }
-    }
-
+  GNUNET_asprintf (&expected_uri,
+                  "http://%s:%u/",
+                  hostname != NULL ? hostname : "localhost",
+                  (unsigned int) port);   
   incoming = (const struct GNUNET_MessageHeader *) message;
   current_adv_uri = strdup ((char*) &incoming[1]);
   if ( 0 == strcmp( expected_uri, current_adv_uri ) )
   incoming = (const struct GNUNET_MessageHeader *) message;
   current_adv_uri = strdup ((char*) &incoming[1]);
   if ( 0 == strcmp( expected_uri, current_adv_uri ) )
-  {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                "Recieved hostlist advertisement with URI `%s' as expected\n", current_adv_uri);
-    adv_arrived = GNUNET_YES;
-    adv_sent = GNUNET_YES;
-  }
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                 "Recieved hostlist advertisement with URI `%s' as expected\n", current_adv_uri);
+      adv_arrived = GNUNET_YES;
+      adv_sent = GNUNET_YES;
+    }
   else
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Expected URI `%s' and recieved URI `%s' differ\n", expected_uri, current_adv_uri);
   else
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Expected URI `%s' and recieved URI `%s' differ\n", expected_uri, current_adv_uri);
-  GNUNET_free_non_null (expected_uri);
+  GNUNET_free (expected_uri);
   GNUNET_free_non_null (hostname);
   return GNUNET_OK;
 }
   GNUNET_free_non_null (hostname);
   return GNUNET_OK;
 }
@@ -383,13 +368,13 @@ setup_learn_peer (struct PeerContext *p, const char *cfgname)
   if ( NULL != filename)  GNUNET_free ( filename );
 
   p->core = GNUNET_CORE_connect (sched, p->cfg,
   if ( NULL != filename)  GNUNET_free ( filename );
 
   p->core = GNUNET_CORE_connect (sched, p->cfg,
-                              GNUNET_TIME_UNIT_FOREVER_REL,
-                              NULL,
-                              NULL,
-                              NULL, NULL,
-                              NULL, GNUNET_NO,
-                              NULL, GNUNET_NO,
-                              learn_handlers );
+                                GNUNET_TIME_UNIT_FOREVER_REL,
+                                NULL,
+                                NULL,
+                                NULL, NULL, NULL,
+                                NULL, GNUNET_NO,
+                                NULL, GNUNET_NO,
+                                learn_handlers );
   GNUNET_assert ( NULL != p->core );
   p->stats = GNUNET_STATISTICS_create (sched, "hostlist", p->cfg);
   GNUNET_assert ( NULL != p->stats );
   GNUNET_assert ( NULL != p->core );
   p->stats = GNUNET_STATISTICS_create (sched, "hostlist", p->cfg);
   GNUNET_assert ( NULL != p->stats );