gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15831 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r15831 - gnunet/src/transport
Date: Mon, 4 Jul 2011 11:01:19 +0200

Author: grothoff
Date: 2011-07-04 11:01:19 +0200 (Mon, 04 Jul 2011)
New Revision: 15831

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/transport_api.c
Log:
fix

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-07-04 08:58:27 UTC 
(rev 15830)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-07-04 09:01:19 UTC 
(rev 15831)
@@ -2489,6 +2489,8 @@
   cpos = clients;
   while (cpos != NULL)
     {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "Transmitting my HELLO to client!\n");
       transmit_to_client (cpos,
                           (const struct GNUNET_MessageHeader *) hello,
                           GNUNET_NO);
@@ -2527,6 +2529,10 @@
 static void
 refresh_hello ()
 {
+#if DEBUG_TRANSPORT_HELLO
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+             "refresh_hello() called!\n");
+#endif
   if (hello_task != GNUNET_SCHEDULER_NO_TASK)
     return;
   hello_task
@@ -2823,7 +2829,6 @@
   struct OwnAddressList *prev;
 
   GNUNET_assert (p->api != NULL);
-
 #if DEBUG_TRANSPORT
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              (add_remove == GNUNET_YES)
@@ -5745,7 +5750,7 @@
   clients = c;
   c->client = client;
   if (our_hello != NULL)
-  {
+    {
 #if DEBUG_TRANSPORT
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Sending our own `%s' to new client\n", "HELLO");
@@ -5757,9 +5762,9 @@
       ats_count = 2;
       size  = sizeof (struct ConnectInfoMessage) + ats_count * sizeof (struct 
GNUNET_TRANSPORT_ATS_Information);
       if (size > GNUNET_SERVER_MAX_MESSAGE_SIZE)
-      {
+       {
          GNUNET_break(0);
-      }
+       }
       cim = GNUNET_malloc (size);
       cim->header.size = htons (size);
       cim->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT);
@@ -5768,20 +5773,28 @@
       (&(cim->ats))[2].value = htonl (0);
       n = neighbours;
       while (n != NULL)
-         {
-                 if (GNUNET_YES == n->received_pong)
-                 {
-                         (&(cim->ats))[0].type = htonl 
(GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
-                         (&(cim->ats))[0].value = htonl (n->distance);
-                         (&(cim->ats))[1].type = htonl 
(GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY);
-                         (&(cim->ats))[1].value = htonl ((uint32_t) 
n->latency.rel_value);
-                         cim->id = n->id;
-                         transmit_to_client (c, &cim->header, GNUNET_NO);
-                 }
-           n = n->next;
-      }
+       {
+         if (GNUNET_YES == n->received_pong)
+           {
+             (&(cim->ats))[0].type = htonl 
(GNUNET_TRANSPORT_ATS_QUALITY_NET_DISTANCE);
+             (&(cim->ats))[0].value = htonl (n->distance);
+             (&(cim->ats))[1].type = htonl 
(GNUNET_TRANSPORT_ATS_QUALITY_NET_DELAY);
+             (&(cim->ats))[1].value = htonl ((uint32_t) n->latency.rel_value);
+             cim->id = n->id;
+             transmit_to_client (c, &cim->header, GNUNET_NO);
+           }
+         n = n->next;
+       }
       GNUNET_free (cim);
-  }
+    }
+  else
+    {
+#if DEBUG_TRANSPORT_HELLO
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "No HELLO created yet, will transmit HELLO to client 
later!\n");
+#endif
+      refresh_hello ();
+    }
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 

Modified: gnunet/src/transport/transport_api.c
===================================================================
--- gnunet/src/transport/transport_api.c        2011-07-04 08:58:27 UTC (rev 
15830)
+++ gnunet/src/transport/transport_api.c        2011-07-04 09:01:19 UTC (rev 
15831)
@@ -1018,7 +1018,13 @@
   hwl->rec = rec;
   hwl->rec_cls = rec_cls;
   if (handle->my_hello == NULL)
-    return;
+    {
+#if DEBUG_TRANSPORT_HELLO
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "No HELLO yet, waiting to receive it from transport 
service\n");
+#endif
+      return;
+    }
   rec (rec_cls, (const struct GNUNET_MessageHeader *) handle->my_hello);
 }
 




reply via email to

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