From 1dce323f4f6bb8a9ba2d43db206386bbfe044138 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philipp=20T=C3=B6lke?= Date: Wed, 15 Jun 2011 07:15:45 +0000 Subject: [PATCH] build the mesh-hello correctly i.e. nbo --- src/mesh/mesh_api.c | 12 ++++++++++-- 1 file 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, for (t = stypes; *t != GNUNET_APPLICATION_TYPE_END; t++, num++); + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "I can handle %d app-types.\n", num); + handle->hello_message_size = sizeof(uint16_t) + /* For the number of types */ num * sizeof(GNUNET_MESH_ApplicationType); /* For the types */ uint16_t *nums = GNUNET_malloc(handle->hello_message_size); GNUNET_MESH_ApplicationType *types = (GNUNET_MESH_ApplicationType*)(nums + 1); - *nums = num; - memcpy(types, stypes, num*sizeof(GNUNET_MESH_ApplicationType)); + *nums = htons(num); + + int i; + for (i = 0; i < num; i++) + { + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "I can handle the app-type %d\n", stypes[i]); + types[i] = htons(stypes[i]); + } handle->hello_message = nums; } -- 2.25.1