From: Philipp Tölke Date: Wed, 15 Jun 2011 07:15:45 +0000 (+0000) Subject: build the mesh-hello correctly X-Git-Tag: initial-import-from-subversion-38251~18175 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1dce323f4f6bb8a9ba2d43db206386bbfe044138;p=oweals%2Fgnunet.git build the mesh-hello correctly i.e. nbo --- 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; }