gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r15620 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r15620 - gnunet/src/mesh
Date: Wed, 15 Jun 2011 09:15:45 +0200

Author: toelke
Date: 2011-06-15 09:15:45 +0200 (Wed, 15 Jun 2011)
New Revision: 15620

Modified:
   gnunet/src/mesh/mesh_api.c
Log:
receive the mesh-hello correctly

i.e. nbo

Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c  2011-06-15 07:15:45 UTC (rev 15619)
+++ gnunet/src/mesh/mesh_api.c  2011-06-15 07:15:45 UTC (rev 15620)
@@ -335,10 +335,10 @@
 {
   struct GNUNET_MESH_Handle *handle = cls;
   uint16_t *num = (uint16_t *) (message + 1);
-  uint16_t *ports = num + 1;
+  GNUNET_MESH_ApplicationType *ports = (GNUNET_MESH_ApplicationType*) (num + 
1);
   unsigned int i;
 
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "The peer %s tells us he supports %d 
application-types.\n", GNUNET_i2s(other), *num);
+  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "The peer %s tells us he supports %d 
application-types.\n", GNUNET_i2s(other), ntohs(*num));
 
   struct peer_list_element *element = handle->connected_peers.head;
   while (element != NULL)
@@ -349,18 +349,28 @@
       element = element->next;
     }
 
-  for (i = 0; i < *num; i++)
+  GNUNET_assert(NULL != element);
+
+  for (i = 0; i < ntohs(*num); i++)
     {
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "The peer %s newly supports the 
application-type %d\n", GNUNET_i2s(other), ntohs(ports[i]));
+      if (GNUNET_APPLICATION_TYPE_END == ntohs(ports[i])) continue;
       struct type_list_element* new_type = GNUNET_malloc(sizeof *new_type);
       new_type->type = (GNUNET_MESH_ApplicationType)ntohs (ports[i]);
       GNUNET_CONTAINER_DLL_insert(element->type_head, element->type_tail, 
new_type);
     }
 
+  struct type_list_element *type;
+  for (type = element->type_head; type != NULL; type = type->next)
+    {
+      GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "The peer %s supports the 
application-type %d\n", GNUNET_i2s(other), type->type);
+    }
+
   struct tunnel_list_element *tunnel = handle->pending_by_type_tunnels.head;
   while (tunnel != NULL)
     {
       struct tunnel_list_element *next = tunnel->next;
-      for (i = 0; i < *num; i++)
+      for (i = 0; i < ntohs(*num); i++)
         {
           if (ntohs (ports[i]) == tunnel->tunnel.application_type)
             {




reply via email to

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