diff options
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r-- | src/transport/transport-testing2.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c index 7204d26da..b354f7c2a 100644 --- a/src/transport/transport-testing2.c +++ b/src/transport/transport-testing2.c | |||
@@ -306,14 +306,14 @@ handle_add_address (void *cls, | |||
306 | { | 306 | { |
307 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; | 307 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; |
308 | uint16_t size; | 308 | uint16_t size; |
309 | |||
310 | size = ntohs (msg->header.size) - sizeof(*msg); | 309 | size = ntohs (msg->header.size) - sizeof(*msg); |
311 | if (0 == size) | 310 | if (0 == size) |
312 | return; /* receive-only communicator */ | 311 | return; /* receive-only communicator */ |
312 | LOG (GNUNET_ERROR_TYPE_DEBUG, "received add address cb %u\n", size); | ||
313 | tc_h->c_address = GNUNET_strdup ((const char *) &msg[1]); | 313 | tc_h->c_address = GNUNET_strdup ((const char *) &msg[1]); |
314 | if (NULL != tc_h->add_address_cb) | 314 | if (NULL != tc_h->add_address_cb) |
315 | { | 315 | { |
316 | LOG (GNUNET_ERROR_TYPE_DEBUG, "calling communicator_available()\n"); | 316 | LOG (GNUNET_ERROR_TYPE_DEBUG, "calling add_address_cb()\n"); |
317 | tc_h->add_address_cb (tc_h->cb_cls, | 317 | tc_h->add_address_cb (tc_h->cb_cls, |
318 | tc_h, | 318 | tc_h, |
319 | tc_h->c_address, | 319 | tc_h->c_address, |
@@ -366,7 +366,7 @@ handle_incoming_msg (void *cls, | |||
366 | { | 366 | { |
367 | tc_h->incoming_msg_cb (tc_h->cb_cls, | 367 | tc_h->incoming_msg_cb (tc_h->cb_cls, |
368 | tc_h, | 368 | tc_h, |
369 | (const struct GNUNET_MessageHeader *) msg); | 369 | msg); |
370 | } | 370 | } |
371 | else | 371 | else |
372 | { | 372 | { |
@@ -452,9 +452,19 @@ handle_add_queue_message (void *cls, | |||
452 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue; | 452 | struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue; |
453 | 453 | ||
454 | tc_queue = tc_h->queue_head; | 454 | tc_queue = tc_h->queue_head; |
455 | while (tc_queue->qid != msg->qid) | 455 | if (NULL != tc_queue) |
456 | { | 456 | { |
457 | tc_queue = tc_queue->next; | 457 | while (tc_queue->qid != msg->qid) |
458 | { | ||
459 | tc_queue = tc_queue->next; | ||
460 | } | ||
461 | } else { | ||
462 | tc_queue = | ||
463 | GNUNET_new (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue); | ||
464 | tc_queue->tc_h = tc_h; | ||
465 | tc_queue->qid = msg->qid; | ||
466 | tc_queue->peer_id = msg->receiver; | ||
467 | GNUNET_CONTAINER_DLL_insert (tc_h->queue_head, tc_h->queue_tail, tc_queue); | ||
458 | } | 468 | } |
459 | GNUNET_assert (tc_queue->qid == msg->qid); | 469 | GNUNET_assert (tc_queue->qid == msg->qid); |
460 | GNUNET_assert (0 == GNUNET_memcmp (&tc_queue->peer_id, &msg->receiver)); | 470 | GNUNET_assert (0 == GNUNET_memcmp (&tc_queue->peer_id, &msg->receiver)); |
@@ -663,7 +673,7 @@ communicator_start ( | |||
663 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start communicator!"); | 673 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start communicator!"); |
664 | return; | 674 | return; |
665 | } | 675 | } |
666 | LOG (GNUNET_ERROR_TYPE_DEBUG, "started communicator\n"); | 676 | LOG (GNUNET_ERROR_TYPE_INFO, "started communicator\n"); |
667 | GNUNET_free (binary); | 677 | GNUNET_free (binary); |
668 | /* TODO */ GNUNET_SCHEDULER_add_shutdown (&shutdown_communicator, | 678 | /* TODO */ GNUNET_SCHEDULER_add_shutdown (&shutdown_communicator, |
669 | tc_h->c_proc); | 679 | tc_h->c_proc); |