aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorPhilipp Tölke <toelke@in.tum.de>2011-06-15 07:15:45 +0000
committerPhilipp Tölke <toelke@in.tum.de>2011-06-15 07:15:45 +0000
commit1dce323f4f6bb8a9ba2d43db206386bbfe044138 (patch)
tree95c211a13ce9eeeff47cea3f445b852dabcf6ad7 /src/mesh
parent6411b58baac8770556fd8881f17e18386f5c950b (diff)
downloadgnunet-1dce323f4f6bb8a9ba2d43db206386bbfe044138.tar.gz
gnunet-1dce323f4f6bb8a9ba2d43db206386bbfe044138.zip
build the mesh-hello correctly
i.e. nbo
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/mesh_api.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c
index 9c822eae5..4de75fb61 100644
--- a/src/mesh/mesh_api.c
+++ b/src/mesh/mesh_api.c
@@ -680,14 +680,22 @@ void build_hello_message(struct GNUNET_MESH_Handle* handle,
680 680
681 for (t = stypes; *t != GNUNET_APPLICATION_TYPE_END; t++, num++); 681 for (t = stypes; *t != GNUNET_APPLICATION_TYPE_END; t++, num++);
682 682
683 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "I can handle %d app-types.\n", num);
684
683 handle->hello_message_size = sizeof(uint16_t) + /* For the number of types */ 685 handle->hello_message_size = sizeof(uint16_t) + /* For the number of types */
684 num * sizeof(GNUNET_MESH_ApplicationType); /* For the types */ 686 num * sizeof(GNUNET_MESH_ApplicationType); /* For the types */
685 687
686 uint16_t *nums = GNUNET_malloc(handle->hello_message_size); 688 uint16_t *nums = GNUNET_malloc(handle->hello_message_size);
687 GNUNET_MESH_ApplicationType *types = (GNUNET_MESH_ApplicationType*)(nums + 1); 689 GNUNET_MESH_ApplicationType *types = (GNUNET_MESH_ApplicationType*)(nums + 1);
688 690
689 *nums = num; 691 *nums = htons(num);
690 memcpy(types, stypes, num*sizeof(GNUNET_MESH_ApplicationType)); 692
693 int i;
694 for (i = 0; i < num; i++)
695 {
696 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "I can handle the app-type %d\n", stypes[i]);
697 types[i] = htons(stypes[i]);
698 }
691 699
692 handle->hello_message = nums; 700 handle->hello_message = nums;
693} 701}