summaryrefslogtreecommitdiff
path: root/src/transport/transport-testing2.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-12-22 12:26:04 +0900
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-12-22 12:26:04 +0900
commitdc090c05b18f416543266e9f47f6a2cff0125b92 (patch)
treed5047b02e4dd0c34e84be747333e1c1c13b772da /src/transport/transport-testing2.c
parent8d2dcee89911253a0018f0dbb9ceacc76f2aaf3d (diff)
fixing tng testcase unix communicator
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r--src/transport/transport-testing2.c22
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,
{
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
uint16_t size;
-
size = ntohs (msg->header.size) - sizeof(*msg);
if (0 == size)
return; /* receive-only communicator */
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "received add address cb %u\n", size);
tc_h->c_address = GNUNET_strdup ((const char *) &msg[1]);
if (NULL != tc_h->add_address_cb)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG, "calling communicator_available()\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "calling add_address_cb()\n");
tc_h->add_address_cb (tc_h->cb_cls,
tc_h,
tc_h->c_address,
@@ -366,7 +366,7 @@ handle_incoming_msg (void *cls,
{
tc_h->incoming_msg_cb (tc_h->cb_cls,
tc_h,
- (const struct GNUNET_MessageHeader *) msg);
+ msg);
}
else
{
@@ -452,9 +452,19 @@ handle_add_queue_message (void *cls,
struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue;
tc_queue = tc_h->queue_head;
- while (tc_queue->qid != msg->qid)
+ if (NULL != tc_queue)
{
- tc_queue = tc_queue->next;
+ while (tc_queue->qid != msg->qid)
+ {
+ tc_queue = tc_queue->next;
+ }
+ } else {
+ tc_queue =
+ GNUNET_new (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue);
+ tc_queue->tc_h = tc_h;
+ tc_queue->qid = msg->qid;
+ tc_queue->peer_id = msg->receiver;
+ GNUNET_CONTAINER_DLL_insert (tc_h->queue_head, tc_h->queue_tail, tc_queue);
}
GNUNET_assert (tc_queue->qid == msg->qid);
GNUNET_assert (0 == GNUNET_memcmp (&tc_queue->peer_id, &msg->receiver));
@@ -663,7 +673,7 @@ communicator_start (
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start communicator!");
return;
}
- LOG (GNUNET_ERROR_TYPE_DEBUG, "started communicator\n");
+ LOG (GNUNET_ERROR_TYPE_INFO, "started communicator\n");
GNUNET_free (binary);
/* TODO */ GNUNET_SCHEDULER_add_shutdown (&shutdown_communicator,
tc_h->c_proc);