From 769c3e9561ea577ca167c74286a5cd092510a5cb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 2 Feb 2014 17:38:22 +0000 Subject: removing depreated 'priority' argument from GNUNET_TRANSPORT_notify_transmit_ready --- src/ats-tests/ats-testing-traffic.c | 85 +++++++++++----------- src/core/gnunet-service-core_neighbours.c | 2 +- src/include/gnunet_transport_service.h | 22 +++++- src/transport/gnunet-transport.c | 12 ++- src/transport/test_quota_compliance.c | 4 +- src/transport/test_transport_api.c | 2 +- .../test_transport_api_bidirectional_connect.c | 3 +- src/transport/test_transport_api_blacklisting.c | 4 +- src/transport/test_transport_api_disconnect.c | 2 +- src/transport/test_transport_api_limited_sockets.c | 3 +- .../test_transport_api_manipulation_cfg.c | 4 +- .../test_transport_api_manipulation_recv_tcp.c | 2 +- .../test_transport_api_manipulation_send_tcp.c | 2 +- src/transport/test_transport_api_monitoring.c | 6 +- .../test_transport_api_monitoring_validation.c | 6 +- src/transport/test_transport_api_reliability.c | 4 +- src/transport/test_transport_api_restart_1peer.c | 2 +- src/transport/test_transport_api_restart_2peers.c | 2 +- src/transport/test_transport_api_unreliability.c | 4 +- .../test_transport_api_unreliability_constant.c | 4 +- src/transport/transport.h | 6 +- src/transport/transport_api.c | 31 ++++---- 22 files changed, 119 insertions(+), 93 deletions(-) diff --git a/src/ats-tests/ats-testing-traffic.c b/src/ats-tests/ats-testing-traffic.c index 06a983d5c..4d5abb1d1 100644 --- a/src/ats-tests/ats-testing-traffic.c +++ b/src/ats-tests/ats-testing-traffic.c @@ -77,6 +77,7 @@ get_delay (struct TrafficGenerator *tg) return delay; } + static size_t send_ping_ready_cb (void *cls, size_t size, void *buf) { @@ -96,24 +97,24 @@ send_ping_ready_cb (void *cls, size_t size, void *buf) return 0; } - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Master [%u]: Sending PING to [%u]\n", - p->me->no, p->dest->no); - + GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, + "Master [%u]: Sending PING to [%u]\n", + p->me->no, p->dest->no); if (top->test_core) { - if (NULL == p->cth) - { - GNUNET_break (0); - } - p->cth = NULL; + if (NULL == p->cth) + { + GNUNET_break (0); + } + p->cth = NULL; } else { - if (NULL == p->tth) - { - GNUNET_break (0); - } - p->tth = NULL; + if (NULL == p->tth) + { + GNUNET_break (0); + } + p->tth = NULL; } msg = (struct GNUNET_MessageHeader *) &msgbuf; @@ -145,30 +146,32 @@ send_ping_ready_cb (void *cls, size_t size, void *buf) static void comm_schedule_send (void *cls, - const struct GNUNET_SCHEDULER_TaskContext* tc) + const struct GNUNET_SCHEDULER_TaskContext *tc) { struct BenchmarkPartner *p = cls; p->tg->send_task = GNUNET_SCHEDULER_NO_TASK; - p->last_message_sent = GNUNET_TIME_absolute_get(); if (GNUNET_YES == top->test_core) { - p->cth = GNUNET_CORE_notify_transmit_ready ( - p->me->ch, GNUNET_NO, - GNUNET_CORE_PRIO_BEST_EFFORT, - GNUNET_TIME_UNIT_MINUTES, &p->dest->id, - TEST_MESSAGE_SIZE, &send_ping_ready_cb, p); + p->cth = GNUNET_CORE_notify_transmit_ready (p->me->ch, GNUNET_NO, + GNUNET_CORE_PRIO_BEST_EFFORT, + GNUNET_TIME_UNIT_MINUTES, + &p->dest->id, + TEST_MESSAGE_SIZE, + &send_ping_ready_cb, p); } else { - p->tth = GNUNET_TRANSPORT_notify_transmit_ready ( - p->me->th, &p->dest->id, TEST_MESSAGE_SIZE, 0,GNUNET_TIME_UNIT_MINUTES, - &send_ping_ready_cb, p); + p->tth = GNUNET_TRANSPORT_notify_transmit_ready (p->me->th, + &p->dest->id, + TEST_MESSAGE_SIZE, + GNUNET_TIME_UNIT_MINUTES, + &send_ping_ready_cb, p); } - } + static size_t comm_send_pong_ready (void *cls, size_t size, void *buf) { @@ -223,11 +226,12 @@ GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p) { GNUNET_assert (NULL == p->tth); p->tth = GNUNET_TRANSPORT_notify_transmit_ready (p->me->th, &p->dest->id, - TEST_MESSAGE_SIZE, 0, GNUNET_TIME_UNIT_MINUTES, &comm_send_pong_ready, + TEST_MESSAGE_SIZE, GNUNET_TIME_UNIT_MINUTES, &comm_send_pong_ready, p); } } + void GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p) { @@ -265,9 +269,8 @@ GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p) * Generate between the source master and the partner and send traffic with a * maximum rate. * - * @base_rate traffic base rate to send data with - * @max_rate traffic maximum rate to send data with - * @frequency + * @param base_rate traffic base rate to send data with + * @param max_rate traffic maximum rate to send data with */ struct TrafficGenerator * GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, @@ -278,8 +281,7 @@ GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, struct GNUNET_TIME_Relative period, struct GNUNET_TIME_Relative duration) { - struct TrafficGenerator * tg; - tg = NULL; + struct TrafficGenerator *tg; if (NULL != dest->tg) { @@ -318,10 +320,10 @@ GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, return tg; } + void GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg) { - GNUNET_CONTAINER_DLL_remove (tg_head, tg_tail, tg); tg->dest->tg = NULL; @@ -332,23 +334,24 @@ GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg) } if (top->test_core) { - if (NULL != tg->dest->cth) - { - GNUNET_CORE_notify_transmit_ready_cancel (tg->dest->cth); - tg->dest->cth = NULL; - } + if (NULL != tg->dest->cth) + { + GNUNET_CORE_notify_transmit_ready_cancel (tg->dest->cth); + tg->dest->cth = NULL; + } } else { - if (NULL != tg->dest->tth) - { - GNUNET_TRANSPORT_notify_transmit_ready_cancel (tg->dest->tth); - tg->dest->tth = NULL; - } + if (NULL != tg->dest->tth) + { + GNUNET_TRANSPORT_notify_transmit_ready_cancel (tg->dest->tth); + tg->dest->tth = NULL; + } } GNUNET_free (tg); } + /** * Stop all traffic generators */ diff --git a/src/core/gnunet-service-core_neighbours.c b/src/core/gnunet-service-core_neighbours.c index 63ba8dbb6..ddca0859a 100644 --- a/src/core/gnunet-service-core_neighbours.c +++ b/src/core/gnunet-service-core_neighbours.c @@ -275,7 +275,7 @@ process_queue (struct Neighbour *n) (unsigned int) m->size, GNUNET_i2s (&n->peer), GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (m->deadline), GNUNET_NO)); n->th = - GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer, m->size, 0, + GNUNET_TRANSPORT_notify_transmit_ready (transport, &n->peer, m->size, GNUNET_TIME_absolute_get_remaining (m->deadline), &transmit_ready, n); diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index 7b94f2209..d4948e5ba 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h @@ -41,7 +41,7 @@ extern "C" /** * Version number of the transport API. */ -#define GNUNET_TRANSPORT_VERSION 0x00000000 +#define GNUNET_TRANSPORT_VERSION 0x00000001 /** @@ -450,6 +450,22 @@ GNUNET_TRANSPORT_try_connect_cancel (struct GNUNET_TRANSPORT_TryConnectHandle *t struct GNUNET_TRANSPORT_TransmitHandle; +/** + * Function called to notify a client about the connection begin ready + * to queue more data. @a buf will be NULL and @a size zero if the + * connection was closed for writing in the meantime. + * + * @param cls closure + * @param size number of bytes available in @a buf + * @param buf where the callee should write the message + * @return number of bytes written to @a buf + */ +typedef size_t +(*GNUNET_TRANSPORT_TransmitReadyNotify) (void *cls, + size_t size, + void *buf); + + /** * Check if we could queue a message of the given size for * transmission. The transport service will take both its internal @@ -459,7 +475,6 @@ struct GNUNET_TRANSPORT_TransmitHandle; * @param handle connection to transport service * @param target who should receive the message * @param size how big is the message we want to transmit? - * @param priority how important is the message? @deprecated - remove? * @param timeout after how long should we give up (and call * notify with buf NULL and size 0)? * @param notify function to call when we are ready to @@ -473,9 +488,8 @@ struct GNUNET_TRANSPORT_TransmitHandle * GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle, const struct GNUNET_PeerIdentity *target, size_t size, - uint32_t priority, struct GNUNET_TIME_Relative timeout, - GNUNET_CONNECTION_TransmitReadyNotify notify, + GNUNET_TRANSPORT_TransmitReadyNotify notify, void *notify_cls); diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index 56df0fbf6..49c31663b 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c @@ -714,8 +714,10 @@ transmit_data (void *cls, size_t size, void *buf) m->type = ntohs (GNUNET_MESSAGE_TYPE_DUMMY); memset (&m[1], 52, size - sizeof(struct GNUNET_MessageHeader)); traffic_sent += size; - th = GNUNET_TRANSPORT_notify_transmit_ready (handle, &pid, BLOCKSIZE * 1024, - 0, GNUNET_TIME_UNIT_FOREVER_REL, &transmit_data, NULL ); + th = GNUNET_TRANSPORT_notify_transmit_ready (handle, &pid, + BLOCKSIZE * 1024, + GNUNET_TIME_UNIT_FOREVER_REL, + &transmit_data, NULL ); if (verbosity > 0) FPRINTF (stdout, _("Transmitting %u bytes to %s\n"), (unsigned int) size, GNUNET_i2s (&pid)); @@ -767,8 +769,10 @@ notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) start_time = GNUNET_TIME_absolute_get (); if (NULL == th) th = GNUNET_TRANSPORT_notify_transmit_ready (handle, peer, - BLOCKSIZE * 1024, 0, GNUNET_TIME_UNIT_FOREVER_REL, &transmit_data, - NULL ); + BLOCKSIZE * 1024, + GNUNET_TIME_UNIT_FOREVER_REL, + &transmit_data, + NULL); else GNUNET_break(0); return; diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c index 0dfe27c64..e1dbc17b6 100644 --- a/src/transport/test_quota_compliance.c +++ b/src/transport/test_quota_compliance.c @@ -336,7 +336,7 @@ notify_ready (void *cls, size_t size, void *buf) if (n < TOTAL_MSGS) { if (th == NULL) - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, TIMEOUT_TRANSMIT, ¬ify_ready, NULL); msg_scheduled = n; @@ -384,7 +384,7 @@ static void sendtask () { start_time = GNUNET_TIME_absolute_get (); - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), TIMEOUT_TRANSMIT, ¬ify_ready, NULL); } diff --git a/src/transport/test_transport_api.c b/src/transport/test_transport_api.c index 0934f681c..4456c1dbf 100644 --- a/src/transport/test_transport_api.c +++ b/src/transport/test_transport_api.c @@ -238,7 +238,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); GNUNET_free (receiver_s); s_sending = GNUNET_YES; - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, TIMEOUT_TRANSMIT, ¬ify_ready, p1); } diff --git a/src/transport/test_transport_api_bidirectional_connect.c b/src/transport/test_transport_api_bidirectional_connect.c index 5bc7d091b..64f39a4d8 100644 --- a/src/transport/test_transport_api_bidirectional_connect.c +++ b/src/transport/test_transport_api_bidirectional_connect.c @@ -93,6 +93,7 @@ end () GNUNET_TRANSPORT_TESTING_stop_peer (tth, p2); } + static void end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { @@ -216,7 +217,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); GNUNET_free (receiver_s); - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, TIMEOUT_TRANSMIT, ¬ify_ready, p1); } diff --git a/src/transport/test_transport_api_blacklisting.c b/src/transport/test_transport_api_blacklisting.c index 146e3477b..71f77a8db 100644 --- a/src/transport/test_transport_api_blacklisting.c +++ b/src/transport/test_transport_api_blacklisting.c @@ -268,11 +268,13 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); GNUNET_free (receiver_s); - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, + TEST_MESSAGE_SIZE, TIMEOUT_TRANSMIT, ¬ify_ready, p1); } + static void notify_connect (void *cls, const struct GNUNET_PeerIdentity *peer) { diff --git a/src/transport/test_transport_api_disconnect.c b/src/transport/test_transport_api_disconnect.c index 24eaa9f71..3f8246142 100644 --- a/src/transport/test_transport_api_disconnect.c +++ b/src/transport/test_transport_api_disconnect.c @@ -261,7 +261,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); GNUNET_free (receiver_s); - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, TIMEOUT_TRANSMIT, ¬ify_ready, p1); } diff --git a/src/transport/test_transport_api_limited_sockets.c b/src/transport/test_transport_api_limited_sockets.c index 511422aa6..617be38d4 100644 --- a/src/transport/test_transport_api_limited_sockets.c +++ b/src/transport/test_transport_api_limited_sockets.c @@ -202,10 +202,11 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) return; - th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, &p2->id, 256, 0, TIMEOUT, + th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, &p2->id, 256, TIMEOUT, ¬ify_ready, &p1); } + static void testing_connect_cb (struct PeerContext *p1, struct PeerContext *p2, void *cls) { diff --git a/src/transport/test_transport_api_manipulation_cfg.c b/src/transport/test_transport_api_manipulation_cfg.c index c9bb5d08a..49e74ffaf 100644 --- a/src/transport/test_transport_api_manipulation_cfg.c +++ b/src/transport/test_transport_api_manipulation_cfg.c @@ -214,7 +214,7 @@ sendtask_request_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) s_sending = GNUNET_YES; start_request = GNUNET_TIME_absolute_get(); - th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, &p2->id, TEST_MESSAGE_SIZE, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p1->th, &p2->id, TEST_MESSAGE_SIZE, TIMEOUT_TRANSMIT, ¬ify_request_ready, p2); } @@ -274,7 +274,7 @@ sendtask_response_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc s_sending = GNUNET_YES; start_response = GNUNET_TIME_absolute_get(); - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, TIMEOUT_TRANSMIT, ¬ify_response_ready, p1); } diff --git a/src/transport/test_transport_api_manipulation_recv_tcp.c b/src/transport/test_transport_api_manipulation_recv_tcp.c index a91866be4..6b86e9ff1 100644 --- a/src/transport/test_transport_api_manipulation_recv_tcp.c +++ b/src/transport/test_transport_api_manipulation_recv_tcp.c @@ -304,7 +304,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } s_sending = GNUNET_YES; - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, TIMEOUT_TRANSMIT, ¬ify_ready, p1); } diff --git a/src/transport/test_transport_api_manipulation_send_tcp.c b/src/transport/test_transport_api_manipulation_send_tcp.c index 2b7fdc250..381d7d38a 100644 --- a/src/transport/test_transport_api_manipulation_send_tcp.c +++ b/src/transport/test_transport_api_manipulation_send_tcp.c @@ -304,7 +304,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } s_sending = GNUNET_YES; - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, TIMEOUT_TRANSMIT, ¬ify_ready, p1); } diff --git a/src/transport/test_transport_api_monitoring.c b/src/transport/test_transport_api_monitoring.c index 0767893ed..221d588ad 100644 --- a/src/transport/test_transport_api_monitoring.c +++ b/src/transport/test_transport_api_monitoring.c @@ -270,12 +270,14 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); GNUNET_free (receiver_s); s_sending = GNUNET_YES; - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, TIMEOUT_TRANSMIT, ¬ify_ready, p1); } -static void done () + +static void +done () { if ((GNUNET_YES == p1_c) && (GNUNET_YES == p2_c) && p1_c_notify && p2_c_notify) { diff --git a/src/transport/test_transport_api_monitoring_validation.c b/src/transport/test_transport_api_monitoring_validation.c index c6afbb27f..80fa3e688 100644 --- a/src/transport/test_transport_api_monitoring_validation.c +++ b/src/transport/test_transport_api_monitoring_validation.c @@ -281,12 +281,14 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); GNUNET_free (receiver_s); s_sending = GNUNET_YES; - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, TEST_MESSAGE_SIZE, TIMEOUT_TRANSMIT, ¬ify_ready, p1); } -static void done () + +static void +done () { if ((GNUNET_YES == p1_c) && (GNUNET_YES == p2_c) && p1_c_notify && p2_c_notify) { diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c index 7bad5ff4e..d2a78d17f 100644 --- a/src/transport/test_transport_api_reliability.c +++ b/src/transport/test_transport_api_reliability.c @@ -327,7 +327,7 @@ notify_ready (void *cls, size_t size, void *buf) if (n < TOTAL_MSGS) { if (th == NULL) - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, TIMEOUT_TRANSMIT, ¬ify_ready, NULL); msg_scheduled = n; @@ -375,7 +375,7 @@ static void sendtask () { start_time = GNUNET_TIME_absolute_get (); - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), TIMEOUT_TRANSMIT, ¬ify_ready, NULL); } diff --git a/src/transport/test_transport_api_restart_1peer.c b/src/transport/test_transport_api_restart_1peer.c index 8472e29c0..f0d5d5660 100644 --- a/src/transport/test_transport_api_restart_1peer.c +++ b/src/transport/test_transport_api_restart_1peer.c @@ -273,7 +273,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); GNUNET_free (receiver_s); - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, TIMEOUT_TRANSMIT, ¬ify_ready, p1); } diff --git a/src/transport/test_transport_api_restart_2peers.c b/src/transport/test_transport_api_restart_2peers.c index 7c1e03991..3b5d63bce 100644 --- a/src/transport/test_transport_api_restart_2peers.c +++ b/src/transport/test_transport_api_restart_2peers.c @@ -270,7 +270,7 @@ sendtask (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) p2->no, GNUNET_i2s (&p2->id), p1->no, receiver_s); GNUNET_free (receiver_s); - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, 256, TIMEOUT_TRANSMIT, ¬ify_ready, p1); } diff --git a/src/transport/test_transport_api_unreliability.c b/src/transport/test_transport_api_unreliability.c index 153a88685..3f40a7179 100644 --- a/src/transport/test_transport_api_unreliability.c +++ b/src/transport/test_transport_api_unreliability.c @@ -412,7 +412,7 @@ notify_ready (void *cls, size_t size, void *buf) while ((size - ret >= s) && (n < TOTAL_MSGS)); if (n < TOTAL_MSGS) { - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, TIMEOUT_TRANSMIT, ¬ify_ready, NULL); msg_scheduled = n; @@ -460,7 +460,7 @@ sendtask () start_time = GNUNET_TIME_absolute_get (); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to send %u messages\n", TOTAL_MSGS); - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), TIMEOUT_TRANSMIT, ¬ify_ready, NULL); } diff --git a/src/transport/test_transport_api_unreliability_constant.c b/src/transport/test_transport_api_unreliability_constant.c index cd5c2ce24..2ff1e4b0c 100644 --- a/src/transport/test_transport_api_unreliability_constant.c +++ b/src/transport/test_transport_api_unreliability_constant.c @@ -333,7 +333,7 @@ notify_ready (void *cls, size_t size, void *buf) while (size - ret >= s); if (n < TOTAL_MSGS) { - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, TIMEOUT_TRANSMIT, ¬ify_ready, NULL); msg_scheduled = n; @@ -380,7 +380,7 @@ static void sendtask () { start_time = GNUNET_TIME_absolute_get (); - th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), 0, + th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, get_size (0), TIMEOUT_TRANSMIT, ¬ify_ready, NULL); } diff --git a/src/transport/transport.h b/src/transport/transport.h index dab5415c2..eceda49d4 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -285,14 +285,14 @@ struct OutboundMessage { /** - * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_SEND + * Type will be #GNUNET_MESSAGE_TYPE_TRANSPORT_SEND */ struct GNUNET_MessageHeader header; /** - * Message priority. + * Always zero. */ - uint32_t priority GNUNET_PACKED; + uint32_t reserved GNUNET_PACKED; /** * Allowed delay. diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index e892dd2ee..f6f608dfb 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c @@ -68,7 +68,7 @@ struct GNUNET_TRANSPORT_TransmitHandle * Function to call when notify_size bytes are available * for transmission. */ - GNUNET_CONNECTION_TransmitReadyNotify notify; + GNUNET_TRANSPORT_TransmitReadyNotify notify; /** * Closure for notify. @@ -91,11 +91,6 @@ struct GNUNET_TRANSPORT_TransmitHandle */ size_t notify_size; - /** - * How important is this message? Not used for control messages. - */ - uint32_t priority; - }; @@ -820,7 +815,7 @@ transport_notify_ready (void *cls, size_t size, void *buf) GNUNET_SERVER_MAX_MESSAGE_SIZE); obm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SEND); obm.header.size = htons (mret + sizeof (struct OutboundMessage)); - obm.priority = htonl (th->priority); + obm.reserved = htonl (0); obm.timeout = GNUNET_TIME_relative_hton (GNUNET_TIME_absolute_get_remaining (th->timeout)); @@ -888,7 +883,8 @@ schedule_transmission_task (void *cls, return; /* no pending messages */ size = n->th->notify_size + sizeof (struct OutboundMessage); } - LOG (GNUNET_ERROR_TYPE_DEBUG, "Calling notify_transmit_ready\n"); + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Calling notify_transmit_ready\n"); h->cth = GNUNET_CLIENT_notify_transmit_ready (h->client, size, GNUNET_TIME_UNIT_FOREVER_REL, @@ -947,7 +943,7 @@ schedule_transmission (struct GNUNET_TRANSPORT_Handle *h) */ static struct GNUNET_TRANSPORT_TransmitHandle * schedule_control_transmit (struct GNUNET_TRANSPORT_Handle *h, size_t size, - GNUNET_CONNECTION_TransmitReadyNotify notify, + GNUNET_TRANSPORT_TransmitReadyNotify notify, void *notify_cls) { struct GNUNET_TRANSPORT_TransmitHandle *th; @@ -1035,7 +1031,8 @@ reconnect (void *cls, h->client = GNUNET_CLIENT_connect ("transport", h->cfg); GNUNET_assert (NULL != h->client); - schedule_control_transmit (h, sizeof (struct StartMessage), &send_start, h); + schedule_control_transmit (h, sizeof (struct StartMessage), + &send_start, h); } @@ -1332,7 +1329,8 @@ GNUNET_TRANSPORT_set_traffic_metric (struct GNUNET_TRANSPORT_Handle *handle, msg->ats_count = htons (ats_count); msg->peer = (*peer); memcpy (&msg[1], ats, ats_count * sizeof (struct GNUNET_ATS_Information)); - schedule_control_transmit (handle, len, &send_metric, msg); + schedule_control_transmit (handle, len, + &send_metric, msg); } @@ -1385,7 +1383,8 @@ GNUNET_TRANSPORT_offer_hello (struct GNUNET_TRANSPORT_Handle *handle, ohh->cont = cont; ohh->cls = cls; ohh->msg = msg; - ohh->tth = schedule_control_transmit (handle, size, &send_hello, ohh); + ohh->tth = schedule_control_transmit (handle, size, + &send_hello, ohh); GNUNET_CONTAINER_DLL_insert (handle->oh_head, handle->oh_tail, ohh); return ohh; } @@ -1542,7 +1541,7 @@ GNUNET_TRANSPORT_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, ret->ready_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); schedule_control_transmit (ret, sizeof (struct StartMessage), - &send_start, ret); + &send_start, ret); return ret; } @@ -1594,7 +1593,6 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) * @param handle connection to transport service * @param target who should receive the message * @param size how big is the message we want to transmit? - * @param priority how important is the message? * @param timeout after how long should we give up (and call * notify with buf NULL and size 0)? * @param notify function to call when we are ready to @@ -1607,9 +1605,9 @@ GNUNET_TRANSPORT_disconnect (struct GNUNET_TRANSPORT_Handle *handle) struct GNUNET_TRANSPORT_TransmitHandle * GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle, const struct GNUNET_PeerIdentity *target, - size_t size, uint32_t priority, + size_t size, struct GNUNET_TIME_Relative timeout, - GNUNET_CONNECTION_TransmitReadyNotify notify, + GNUNET_TRANSPORT_TransmitReadyNotify notify, void *notify_cls) { struct Neighbour *n; @@ -1637,7 +1635,6 @@ GNUNET_TRANSPORT_notify_transmit_ready (struct GNUNET_TRANSPORT_Handle *handle, th->notify_cls = notify_cls; th->timeout = GNUNET_TIME_relative_to_absolute (timeout); th->notify_size = size; - th->priority = priority; n->th = th; /* calculate when our transmission should be ready */ delay = GNUNET_BANDWIDTH_tracker_get_delay (&n->out_tracker, size + n->traffic_overhead); -- cgit v1.2.3