From 1ca80565458244e9a9622d65bd3953fa3478372a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 4 Feb 2020 19:18:25 +0100 Subject: [PATCH] speed up message goodput in perf_mq(client) by 1/3rd --- src/util/client.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/util/client.c b/src/util/client.c index 024f34b3a..93442f0c6 100644 --- a/src/util/client.c +++ b/src/util/client.c @@ -270,11 +270,22 @@ RETRY: ret = GNUNET_NETWORK_socket_send (cstate->sock, &pos[cstate->msg_off], len - cstate->msg_off); + if ( (-1 == ret) && + (EAGAIN == errno) ) + { + cstate->send_task + = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, + cstate->sock, + &transmit_ready, + cstate); + return; + } if (-1 == ret) { LOG (GNUNET_ERROR_TYPE_WARNING, - "Error during sending message of type %u\n", - ntohs (cstate->msg->type)); + "Error during sending message of type %u: %s\n", + ntohs (cstate->msg->type), + strerror (errno)); if (EINTR == errno) { LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -845,10 +856,8 @@ connection_client_send_impl (struct GNUNET_MQ_Handle *mq, return; /* still waiting for connection */ } cstate->send_task - = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, - cstate->sock, - &transmit_ready, - cstate); + = GNUNET_SCHEDULER_add_now (&transmit_ready, + cstate); } -- 2.25.1