gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10120 - gnunet/src/peerinfo


From: gnunet
Subject: [GNUnet-SVN] r10120 - gnunet/src/peerinfo
Date: Fri, 22 Jan 2010 17:55:16 +0100

Author: grothoff
Date: 2010-01-22 17:55:16 +0100 (Fri, 22 Jan 2010)
New Revision: 10120

Modified:
   gnunet/src/peerinfo/gnunet-service-peerinfo.c
   gnunet/src/peerinfo/peerinfo_api.c
   gnunet/src/peerinfo/test_peerinfo_api.c
Log:
fix

Modified: gnunet/src/peerinfo/gnunet-service-peerinfo.c
===================================================================
--- gnunet/src/peerinfo/gnunet-service-peerinfo.c       2010-01-22 15:52:40 UTC 
(rev 10119)
+++ gnunet/src/peerinfo/gnunet-service-peerinfo.c       2010-01-22 16:55:16 UTC 
(rev 10120)
@@ -486,8 +486,6 @@
           change_host_trust (&pos->identity, trust_change);
           hs = 0;
           im = (struct InfoMessage *) buf;
-         im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
-         im->header.size = htons (sizeof (struct InfoMessage) + hs);
           if (pos->hello != NULL)
             {
               hs = GNUNET_HELLO_size (pos->hello);
@@ -496,6 +494,8 @@
                              sizeof (struct InfoMessage));
               memcpy (&im[1], pos->hello, hs);
             }
+         im->header.type = htons (GNUNET_MESSAGE_TYPE_PEERINFO_INFO);
+         im->header.size = htons (sizeof (struct InfoMessage) + hs);
           im->trust = htonl (pos->trust);
           im->peer = pos->identity;
           GNUNET_SERVER_transmit_context_append_message (tc,

Modified: gnunet/src/peerinfo/peerinfo_api.c
===================================================================
--- gnunet/src/peerinfo/peerinfo_api.c  2010-01-22 15:52:40 UTC (rev 10119)
+++ gnunet/src/peerinfo/peerinfo_api.c  2010-01-22 16:55:16 UTC (rev 10120)
@@ -223,7 +223,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Size of `%s' is %u bytes\n",
              "HELLO",
-             (unsigned int) GNUNET_HELLO_size (hello));
+             (hello == NULL) ? 0 : (unsigned int) GNUNET_HELLO_size (hello));
 #endif  
   ic->callback (ic->callback_cls, &im->peer, hello, ntohl (im->trust));
   GNUNET_CLIENT_receive (ic->client,

Modified: gnunet/src/peerinfo/test_peerinfo_api.c
===================================================================
--- gnunet/src/peerinfo/test_peerinfo_api.c     2010-01-22 15:52:40 UTC (rev 
10119)
+++ gnunet/src/peerinfo/test_peerinfo_api.c     2010-01-22 16:55:16 UTC (rev 
10120)
@@ -40,6 +40,8 @@
 
 static const struct GNUNET_CONFIGURATION_Handle *cfg;
 
+static struct GNUNET_PEERINFO_IteratorContext *ic;
+
 static unsigned int retries;
 
 static int
@@ -105,19 +107,20 @@
 
   if (peer == NULL)
     {
+      ic = NULL;
       if ( (3 == *ok) &&
-          (retries < 5) )
+          (retries < 50) )
        {
          /* try again */
          retries++;      
          add_peer ();
-         GNUNET_PEERINFO_iterate (cfg,
-                                  sched,
-                                  NULL,
-                                  0,
-                                  GNUNET_TIME_relative_multiply
-                                  (GNUNET_TIME_UNIT_SECONDS, 15), 
-                                  &process, cls);
+         ic = GNUNET_PEERINFO_iterate (cfg,
+                                       sched,
+                                       NULL,
+                                       0,
+                                       GNUNET_TIME_relative_multiply
+                                       (GNUNET_TIME_UNIT_SECONDS, 15), 
+                                       &process, cls);
          return;
        }
       GNUNET_assert (peer == NULL);
@@ -126,7 +129,6 @@
       *ok = 0;
       return;
     }
-
   if (hello != NULL)
     {
       GNUNET_assert (3 == *ok);
@@ -148,12 +150,12 @@
   sched = s;
   cfg = c;
   add_peer ();
-  GNUNET_PEERINFO_iterate (cfg,
-                           sched,
-                           NULL,
-                           0,
-                           GNUNET_TIME_relative_multiply
-                           (GNUNET_TIME_UNIT_SECONDS, 15), &process, cls);
+  ic = GNUNET_PEERINFO_iterate (cfg,
+                               sched,
+                               NULL,
+                               0,
+                               GNUNET_TIME_relative_multiply
+                               (GNUNET_TIME_UNIT_SECONDS, 15), &process, cls);
 }
 
 





reply via email to

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