aboutsummaryrefslogtreecommitdiff
path: root/src/multicast
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-11-09 23:12:27 +0000
committerGabor X Toth <*@tg-x.net>2013-11-09 23:12:27 +0000
commit172ab07eeb1215cc9d22dabc589f7529ac2d59ea (patch)
treed75fc75033c7e93b58c1908f06c7b856bc317b8e /src/multicast
parentd10808d7f17c5f6f1356c22ef0992965cbaf5ce1 (diff)
downloadgnunet-172ab07eeb1215cc9d22dabc589f7529ac2d59ea.tar.gz
gnunet-172ab07eeb1215cc9d22dabc589f7529ac2d59ea.zip
psyc: handling messages from multicast and passing them to clients; pause/resume fixes
Diffstat (limited to 'src/multicast')
-rw-r--r--src/multicast/multicast_api.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c
index fa177ec55..40fb6cc33 100644
--- a/src/multicast/multicast_api.c
+++ b/src/multicast/multicast_api.c
@@ -363,11 +363,12 @@ schedule_origin_to_all (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
363 363
364 size_t buf_size = GNUNET_MULTICAST_FRAGMENT_MAX_SIZE; 364 size_t buf_size = GNUNET_MULTICAST_FRAGMENT_MAX_SIZE;
365 struct GNUNET_MULTICAST_MessageHeader *msg 365 struct GNUNET_MULTICAST_MessageHeader *msg
366 = GNUNET_malloc (sizeof (*msg) + buf_size); 366 = GNUNET_malloc (buf_size);
367 buf_size -= sizeof (*msg);
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)
370 || buf_size > GNUNET_MULTICAST_FRAGMENT_MAX_SIZE) 371 || sizeof (*msg) + buf_size > GNUNET_MULTICAST_FRAGMENT_MAX_SIZE)
371 { 372 {
372 LOG (GNUNET_ERROR_TYPE_ERROR, 373 LOG (GNUNET_ERROR_TYPE_ERROR,
373 "MasterTransmitNotify() returned error or invalid message size.\n"); 374 "MasterTransmitNotify() returned error or invalid message size.\n");
@@ -379,15 +380,15 @@ schedule_origin_to_all (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc
379 return; /* Transmission paused. */ 380 return; /* Transmission paused. */
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 (buf_size); 383 msg->header.size = htons (sizeof (*msg) + buf_size);
383 msg->message_id = mh->message_id; 384 msg->message_id = 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 = orig->next_fragment_id++;
388 msg->fragment_offset = mh->fragment_offset; 389 msg->fragment_offset = mh->fragment_offset;
389 mh->fragment_offset += buf_size; 390 mh->fragment_offset += sizeof (*msg) + buf_size;
390 msg->purpose.size = htonl (buf_size 391 msg->purpose.size = htonl (sizeof (*msg) + buf_size
391 - sizeof (msg->header) 392 - sizeof (msg->header)
392 - sizeof (msg->hop_counter) 393 - sizeof (msg->hop_counter)
393 - sizeof (msg->signature)); 394 - sizeof (msg->signature));