diff options
Diffstat (limited to 'src/multicast/multicast_api.c')
-rw-r--r-- | src/multicast/multicast_api.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/src/multicast/multicast_api.c b/src/multicast/multicast_api.c index 25af614af..b23320c72 100644 --- a/src/multicast/multicast_api.c +++ b/src/multicast/multicast_api.c | |||
@@ -178,17 +178,21 @@ message_callback (void *cls, const struct GNUNET_HashCode *chan_key_hash, | |||
178 | const struct GNUNET_MessageHeader *msg = cls; | 178 | const struct GNUNET_MessageHeader *msg = cls; |
179 | struct GNUNET_MULTICAST_Group *grp = group; | 179 | struct GNUNET_MULTICAST_Group *grp = group; |
180 | 180 | ||
181 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
182 | "Calling message callback for a message of type %u and size %u.\n", | ||
183 | ntohs (msg->type), ntohs (msg->size)); | ||
184 | |||
185 | if (GNUNET_YES == grp->is_origin) | 181 | if (GNUNET_YES == grp->is_origin) |
186 | { | 182 | { |
183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
184 | "Calling origin's message callback " | ||
185 | "for a message of type %u and size %u.\n", | ||
186 | ntohs (msg->type), ntohs (msg->size)); | ||
187 | struct GNUNET_MULTICAST_Origin *orig = (struct GNUNET_MULTICAST_Origin *) grp; | 187 | struct GNUNET_MULTICAST_Origin *orig = (struct GNUNET_MULTICAST_Origin *) grp; |
188 | orig->message_cb (orig->cls, msg); | 188 | orig->message_cb (orig->cls, msg); |
189 | } | 189 | } |
190 | else | 190 | else |
191 | { | 191 | { |
192 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
193 | "Calling slave's message callback " | ||
194 | "for a message of type %u and size %u.\n", | ||
195 | ntohs (msg->type), ntohs (msg->size)); | ||
192 | struct GNUNET_MULTICAST_Member *mem = (struct GNUNET_MULTICAST_Member *) grp; | 196 | struct GNUNET_MULTICAST_Member *mem = (struct GNUNET_MULTICAST_Member *) grp; |
193 | mem->message_cb (mem->cls, msg); | 197 | mem->message_cb (mem->cls, msg); |
194 | } | 198 | } |
@@ -449,8 +453,8 @@ schedule_origin_to_all (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
449 | struct GNUNET_MULTICAST_Origin *orig = cls; | 453 | struct GNUNET_MULTICAST_Origin *orig = cls; |
450 | struct GNUNET_MULTICAST_OriginMessageHandle *mh = &orig->msg_handle; | 454 | struct GNUNET_MULTICAST_OriginMessageHandle *mh = &orig->msg_handle; |
451 | 455 | ||
452 | size_t buf_size = GNUNET_MULTICAST_FRAGMENT_MAX_PAYLOAD; | 456 | size_t buf_size = GNUNET_MULTICAST_FRAGMENT_MAX_SIZE; |
453 | char buf[GNUNET_MULTICAST_FRAGMENT_MAX_PAYLOAD] = ""; | 457 | char buf[GNUNET_MULTICAST_FRAGMENT_MAX_SIZE] = ""; |
454 | struct GNUNET_MULTICAST_MessageHeader *msg | 458 | struct GNUNET_MULTICAST_MessageHeader *msg |
455 | = (struct GNUNET_MULTICAST_MessageHeader *) buf; | 459 | = (struct GNUNET_MULTICAST_MessageHeader *) buf; |
456 | int ret = mh->notify (mh->notify_cls, &buf_size, &msg[1]); | 460 | int ret = mh->notify (mh->notify_cls, &buf_size, &msg[1]); |
@@ -495,9 +499,9 @@ schedule_origin_to_all (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc | |||
495 | handle_multicast_message (&orig->grp, msg); | 499 | handle_multicast_message (&orig->grp, msg); |
496 | 500 | ||
497 | if (GNUNET_NO == ret) | 501 | if (GNUNET_NO == ret) |
498 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 502 | GNUNET_SCHEDULER_add_delayed ( |
499 | (GNUNET_TIME_UNIT_SECONDS, 1), | 503 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1), |
500 | schedule_origin_to_all, orig); | 504 | schedule_origin_to_all, orig); |
501 | } | 505 | } |
502 | 506 | ||
503 | 507 | ||
@@ -526,10 +530,10 @@ GNUNET_MULTICAST_origin_to_all (struct GNUNET_MULTICAST_Origin *origin, | |||
526 | mh->notify = notify; | 530 | mh->notify = notify; |
527 | mh->notify_cls = notify_cls; | 531 | mh->notify_cls = notify_cls; |
528 | 532 | ||
529 | /* FIXME: remove delay, it's there only for testing */ | 533 | /* add some delay for testing */ |
530 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 534 | GNUNET_SCHEDULER_add_delayed ( |
531 | (GNUNET_TIME_UNIT_SECONDS, 1), | 535 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1), |
532 | schedule_origin_to_all, origin); | 536 | schedule_origin_to_all, origin); |
533 | return &origin->msg_handle; | 537 | return &origin->msg_handle; |
534 | } | 538 | } |
535 | 539 | ||