diff options
author | Gabor X Toth <*@tg-x.net> | 2014-01-06 00:09:43 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2014-01-06 00:09:43 +0000 |
commit | 1a0ffe2288b97b47a5b2bfbda2f9438680429422 (patch) | |
tree | 72db4cd67f06253a60bf3e2966fd0b1bf55eba5c /src/multicast | |
parent | 43d497d7c4ebb6efae37ae4bb2f812a68aa64a32 (diff) | |
download | gnunet-1a0ffe2288b97b47a5b2bfbda2f9438680429422.tar.gz gnunet-1a0ffe2288b97b47a5b2bfbda2f9438680429422.zip |
psyc: ipc messages, notify callback for modifiers, tests
Diffstat (limited to 'src/multicast')
-rw-r--r-- | src/multicast/multicast_api.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c index 6b784c2f0..bb6a57b58 100644 --- a/src/multicast/multicast_api.c +++ b/src/multicast/multicast_api.c | |||
@@ -362,8 +362,9 @@ schedule_origin_to_all (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
362 | struct GNUNET_MULTICAST_OriginMessageHandle *mh = &orig->msg_handle; | 362 | struct GNUNET_MULTICAST_OriginMessageHandle *mh = &orig->msg_handle; |
363 | 363 | ||
364 | size_t buf_size = GNUNET_MULTICAST_FRAGMENT_MAX_PAYLOAD; | 364 | size_t buf_size = GNUNET_MULTICAST_FRAGMENT_MAX_PAYLOAD; |
365 | char buf[GNUNET_MULTICAST_FRAGMENT_MAX_PAYLOAD] = ""; | ||
365 | struct GNUNET_MULTICAST_MessageHeader *msg | 366 | struct GNUNET_MULTICAST_MessageHeader *msg |
366 | = GNUNET_malloc (buf_size); | 367 | = (struct GNUNET_MULTICAST_MessageHeader *) buf; |
367 | int ret = mh->notify (mh->notify_cls, &buf_size, &msg[1]); | 368 | int ret = mh->notify (mh->notify_cls, &buf_size, &msg[1]); |
368 | 369 | ||
369 | if (! (GNUNET_YES == ret || GNUNET_NO == ret) | 370 | if (! (GNUNET_YES == ret || GNUNET_NO == ret) |
@@ -380,12 +381,12 @@ schedule_origin_to_all (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
380 | 381 | ||
381 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE); | 382 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE); |
382 | msg->header.size = htons (sizeof (*msg) + buf_size); | 383 | msg->header.size = htons (sizeof (*msg) + buf_size); |
383 | msg->message_id = mh->message_id; | 384 | msg->message_id = GNUNET_htonll (mh->message_id); |
384 | msg->group_generation = mh->group_generation; | 385 | msg->group_generation = mh->group_generation; |
385 | 386 | ||
386 | /* FIXME: add fragment ID and signature in the service instead of here */ | 387 | /* FIXME: add fragment ID and signature in the service instead of here */ |
387 | msg->fragment_id = orig->next_fragment_id++; | 388 | msg->fragment_id = GNUNET_ntohll (orig->next_fragment_id++); |
388 | msg->fragment_offset = mh->fragment_offset; | 389 | msg->fragment_offset = GNUNET_ntohll (mh->fragment_offset); |
389 | mh->fragment_offset += sizeof (*msg) + buf_size; | 390 | mh->fragment_offset += sizeof (*msg) + buf_size; |
390 | msg->purpose.size = htonl (sizeof (*msg) + buf_size | 391 | msg->purpose.size = htonl (sizeof (*msg) + buf_size |
391 | - sizeof (msg->header) | 392 | - sizeof (msg->header) |