aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing2.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport-testing2.c')
-rw-r--r--src/transport/transport-testing2.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c
index b354f7c2a..230c35b4f 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -358,21 +358,39 @@ check_incoming_msg (void *cls,
358 */ 358 */
359static void 359static void
360handle_incoming_msg (void *cls, 360handle_incoming_msg (void *cls,
361 const struct GNUNET_TRANSPORT_IncomingMessage *msg) 361 const struct GNUNET_TRANSPORT_IncomingMessage *inc_msg)
362{ 362{
363 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls; 363 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
364 struct GNUNET_MessageHeader *msg;
365 msg = (struct GNUNET_MessageHeader *)&inc_msg[1];
366 size_t payload_len = ntohs (msg->size) - sizeof (struct
367 GNUNET_MessageHeader);
364 368
365 if (NULL != tc_h->incoming_msg_cb) 369 if (NULL != tc_h->incoming_msg_cb)
366 { 370 {
367 tc_h->incoming_msg_cb (tc_h->cb_cls, 371 tc_h->incoming_msg_cb (tc_h->cb_cls,
368 tc_h, 372 tc_h,
369 msg); 373 (char*) &msg[1],
374 payload_len);
370 } 375 }
371 else 376 else
372 { 377 {
373 LOG (GNUNET_ERROR_TYPE_WARNING, 378 LOG (GNUNET_ERROR_TYPE_WARNING,
374 "Incoming message from communicator but no handler!\n"); 379 "Incoming message from communicator but no handler!\n");
375 } 380 }
381 if (0 != ntohl (inc_msg->fc_on))
382 {
383 /* send ACK when done to communicator for flow control! */
384 struct GNUNET_MQ_Envelope *env;
385 struct GNUNET_TRANSPORT_IncomingMessageAck *ack;
386
387 env = GNUNET_MQ_msg (ack, GNUNET_MESSAGE_TYPE_TRANSPORT_INCOMING_MSG_ACK);
388 ack->reserved = htonl (0);
389 ack->fc_id = inc_msg->fc_id;
390 ack->sender = inc_msg->sender;
391 GNUNET_MQ_send (tc_h->c_mq, env);
392 }
393
376 GNUNET_SERVICE_client_continue (tc_h->client); 394 GNUNET_SERVICE_client_continue (tc_h->client);
377} 395}
378 396
@@ -458,7 +476,9 @@ handle_add_queue_message (void *cls,
458 { 476 {
459 tc_queue = tc_queue->next; 477 tc_queue = tc_queue->next;
460 } 478 }
461 } else { 479 }
480 else
481 {
462 tc_queue = 482 tc_queue =
463 GNUNET_new (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue); 483 GNUNET_new (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue);
464 tc_queue->tc_h = tc_h; 484 tc_queue->tc_h = tc_h;
@@ -802,9 +822,7 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission *
802GNUNET_TRANSPORT_TESTING_transport_communicator_send 822GNUNET_TRANSPORT_TESTING_transport_communicator_send
803 (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue, 823 (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue,
804 const void *payload, 824 const void *payload,
805 size_t payload_size /*, 825 size_t payload_size)
806 GNUNET_TRANSPORT_TESTING_SuccessStatus cb,
807 void *cb_cls*/)
808{ 826{
809 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission *tc_t; 827 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorTransmission *tc_t;
810 struct GNUNET_MessageHeader *mh; 828 struct GNUNET_MessageHeader *mh;