From 914ec7ef9e59b69868b92fced96d6693b2097e13 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 11 Mar 2011 12:44:06 +0000 Subject: [PATCH] add cork option to core api: --- src/chat/gnunet-service-chat.c | 6 ++++++ src/core/core_api.c | 2 ++ src/dht/gnunet-service-dht.c | 4 +++- src/dv/gnunet-service-dv.c | 15 +++++++++++---- src/fs/gnunet-service-fs.c | 3 +++ src/fs/gnunet-service-fs_cp.c | 2 ++ src/hostlist/hostlist-server.c | 1 + src/include/gnunet_core_service.h | 2 ++ src/mesh/mesh_api.c | 1 + src/topology/gnunet-daemon-topology.c | 4 +++- 10 files changed, 34 insertions(+), 6 deletions(-) diff --git a/src/chat/gnunet-service-chat.c b/src/chat/gnunet-service-chat.c index bbf4dd8f1..a1e180009 100644 --- a/src/chat/gnunet-service-chat.c +++ b/src/chat/gnunet-service-chat.c @@ -262,6 +262,7 @@ send_message_noficiation (void *cls, #endif my_msg = GNUNET_memdup (msg, ntohs (msg->header.size)); if (NULL == GNUNET_CORE_notify_transmit_ready (core, + GNUNET_NO, 1, MAX_TRANSMIT_DELAY, &pid, @@ -553,6 +554,7 @@ send_join_noficiation (void *cls, strlen (entry->room) + entry->meta_len; if (NULL == GNUNET_CORE_notify_transmit_ready (core, + GNUNET_NO, 1, MAX_TRANSMIT_DELAY, &pid, @@ -750,6 +752,7 @@ send_confirmation_receipt (void *cls, my_receipt = GNUNET_memdup (receipt, sizeof (struct P2PConfirmationReceiptMessage)); if (NULL == GNUNET_CORE_notify_transmit_ready (core, + GNUNET_YES, 1, MAX_TRANSMIT_DELAY, &pid, @@ -936,6 +939,7 @@ send_leave_noficiation (void *cls, public_key = GNUNET_memdup (&entry->public_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded)); if (NULL == GNUNET_CORE_notify_transmit_ready (core, + GNUNET_YES, 1, MAX_TRANSMIT_DELAY, &pid, @@ -1408,6 +1412,7 @@ handle_p2p_sync_request (void *cls, strlen (entry->room) + entry->meta_len; th = GNUNET_CORE_notify_transmit_ready (core, + GNUNET_NO, 1, MAX_TRANSMIT_DELAY, other, @@ -1589,6 +1594,7 @@ peer_connect_handler (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Peer connected: %s\n", GNUNET_i2s (peer)); th = GNUNET_CORE_notify_transmit_ready (core, + GNUNET_YES, 1, MAX_TRANSMIT_DELAY, peer, diff --git a/src/core/core_api.c b/src/core/core_api.c index 16479b2d3..a0f72090d 100644 --- a/src/core/core_api.c +++ b/src/core/core_api.c @@ -1483,6 +1483,7 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle) * established (and the client has been informed about this). * * @param handle connection to core service + * @param cork is corking allowed for this transmission? * @param priority how important is the message? * @param maxdelay how long can the message wait? * @param target who should receive the message, @@ -1496,6 +1497,7 @@ GNUNET_CORE_disconnect (struct GNUNET_CORE_Handle *handle) */ struct GNUNET_CORE_TransmitHandle * GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, + int cork, uint32_t priority, struct GNUNET_TIME_Relative maxdelay, const struct GNUNET_PeerIdentity *target, diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c index d26039adc..e455cbc30 100644 --- a/src/dht/gnunet-service-dht.c +++ b/src/dht/gnunet-service-dht.c @@ -1076,7 +1076,9 @@ try_core_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) if (reply_counter >= MAX_REPLY_TIMES) reply_counter = 0; peer->th = - GNUNET_CORE_notify_transmit_ready (coreAPI, pending->importance, + GNUNET_CORE_notify_transmit_ready (coreAPI, + GNUNET_YES, + pending->importance, pending->timeout, &peer->id, ssize, &core_transmit_notify, peer); if (peer->th == NULL) diff --git a/src/dv/gnunet-service-dv.c b/src/dv/gnunet-service-dv.c index a4c78a942..900c8f5d7 100644 --- a/src/dv/gnunet-service-dv.c +++ b/src/dv/gnunet-service-dv.c @@ -864,9 +864,16 @@ try_core_send (void *cls, return; /* Message send already in progress */ if ((pending != NULL) && (coreAPI != NULL)) - core_transmit_handle = GNUNET_CORE_notify_transmit_ready (coreAPI, pending->importance, pending->timeout, &pending->recipient, pending->msg_size, &core_transmit_notify, NULL); + core_transmit_handle = GNUNET_CORE_notify_transmit_ready (coreAPI, + GNUNET_YES, + pending->importance, + pending->timeout, + &pending->recipient, + pending->msg_size, + &core_transmit_notify, NULL); } + /** * Function called to notify a client about the socket * being ready to queue more data. "buf" will be @@ -939,7 +946,7 @@ size_t core_transmit_notify (void *cls, GNUNET_SCHEDULER_add_now(&try_core_send, NULL); /*if (reply != NULL) - core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, reply->importance, reply->timeout, &reply->recipient, reply->msg_size, &core_transmit_notify, NULL);*/ + core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES, reply->importance, reply->timeout, &reply->recipient, reply->msg_size, &core_transmit_notify, NULL);*/ return off; } @@ -1704,7 +1711,7 @@ neighbor_send_task (void *cls, GNUNET_SCHEDULER_add_now(try_core_send, NULL); /*if (core_transmit_handle == NULL) - core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, default_dv_priority, GNUNET_TIME_relative_get_forever(), &to->identity, sizeof(p2p_dv_MESSAGE_NeighborInfo), &core_transmit_notify, NULL);*/ + core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES, default_dv_priority, GNUNET_TIME_relative_get_forever(), &to->identity, sizeof(p2p_dv_MESSAGE_NeighborInfo), &core_transmit_notify, NULL);*/ } @@ -2080,7 +2087,7 @@ static int schedule_disconnect_messages (void *cls, GNUNET_SCHEDULER_add_now(try_core_send, NULL); /*if (core_transmit_handle == NULL) - core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, default_dv_priority, GNUNET_TIME_relative_get_forever(), ¬ify->identity, sizeof(p2p_dv_MESSAGE_Disconnect), &core_transmit_notify, NULL);*/ + core_transmit_handle = GNUNET_CORE_notify_transmit_ready(coreAPI, GNUNET_YES, default_dv_priority, GNUNET_TIME_relative_get_forever(), ¬ify->identity, sizeof(p2p_dv_MESSAGE_Disconnect), &core_transmit_notify, NULL);*/ return GNUNET_YES; } diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index cbfac9322..101698160 100644 --- a/src/fs/gnunet-service-fs.c +++ b/src/fs/gnunet-service-fs.c @@ -1163,6 +1163,7 @@ consider_migration (void *cls, } cp->cth = GNUNET_CORE_notify_transmit_ready (core, + GNUNET_YES, 0, GNUNET_TIME_UNIT_FOREVER_REL, (const struct GNUNET_PeerIdentity*) key, msize + sizeof (struct PutMessage), @@ -2169,6 +2170,7 @@ delayed_transmission_request (void *cls, &pid); cp->last_transmission_request_start = GNUNET_TIME_absolute_get (); cp->cth = GNUNET_CORE_notify_transmit_ready (core, + GNUNET_YES, pm->priority, GNUNET_CONSTANTS_SERVICE_TIMEOUT, &pid, @@ -2405,6 +2407,7 @@ add_to_pending_messages_for_peer (struct ConnectedPeer *cp, /* need to schedule transmission */ cp->last_transmission_request_start = GNUNET_TIME_absolute_get (); cp->cth = GNUNET_CORE_notify_transmit_ready (core, + GNUNET_YES, cp->pending_messages_head->priority, MAX_TRANSMIT_DELAY, &pid, diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c index 6e39d7bd2..4d1cba508 100644 --- a/src/fs/gnunet-service-fs_cp.c +++ b/src/fs/gnunet-service-fs_cp.c @@ -368,6 +368,7 @@ core_reserve_callback (void *cls, { /* reservation success, try transmission now! */ pth->cth = GNUNET_CORE_notify_transmit_ready (GSF_core, + GNUNET_YES, pth->priority, GNUNET_TIME_absolute_get_remaining (pth->timeout), peer, @@ -1110,6 +1111,7 @@ GSF_peer_transmit_ (struct GSF_ConnectedPeer *cp, if (is_ready) { pth->cth = GNUNET_CORE_notify_transmit_ready (GSF_core, + GNUNET_YES, priority, timeout, &target, diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index 91354b87c..62d4fa64b 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c @@ -414,6 +414,7 @@ connect_handler (void *cls, "Asked core to transmit advertisement message with a size of %u bytes to peer `%s'\n", size,GNUNET_i2s(peer)); if (NULL == GNUNET_CORE_notify_transmit_ready (core, + GNUNET_YES, 0, GNUNET_ADV_TIMEOUT, peer, diff --git a/src/include/gnunet_core_service.h b/src/include/gnunet_core_service.h index 5664d34fc..755604b88 100644 --- a/src/include/gnunet_core_service.h +++ b/src/include/gnunet_core_service.h @@ -414,6 +414,7 @@ struct GNUNET_CORE_TransmitHandle; * * * @param handle connection to core service + * @param cork is corking allowed for this transmission? * @param priority how important is the message? * @param maxdelay how long can the message wait? * @param target who should receive the message, @@ -437,6 +438,7 @@ struct GNUNET_CORE_TransmitHandle * GNUNET_CORE_notify_transmit_ready (struct GNUNET_CORE_Handle *handle, + int cork, uint32_t priority, struct GNUNET_TIME_Relative diff --git a/src/mesh/mesh_api.c b/src/mesh/mesh_api.c index f714d32bb..f539312cf 100644 --- a/src/mesh/mesh_api.c +++ b/src/mesh/mesh_api.c @@ -441,6 +441,7 @@ GNUNET_MESH_notify_transmit_ready (struct cls->notify = notify; cls->tunnel = tunnel; GNUNET_CORE_notify_transmit_ready(tunnel->handle->core, + cork, priority, maxdelay, &tunnel->peer, diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c index 1441e218a..2fa336754 100644 --- a/src/topology/gnunet-daemon-topology.c +++ b/src/topology/gnunet-daemon-topology.c @@ -635,7 +635,9 @@ schedule_next_hello (void *cls, if (delay.rel_value == 0) { /* now! */ - pl->hello_req = GNUNET_CORE_notify_transmit_ready (handle, 0, + pl->hello_req = GNUNET_CORE_notify_transmit_ready (handle, + GNUNET_YES, + 0, GNUNET_CONSTANTS_SERVICE_TIMEOUT, &pl->pid, next_want, -- 2.25.1