gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] 01/14: allow more than one ACK being given to us a


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 01/14: allow more than one ACK being given to us at a time
Date: Mon, 23 Jan 2017 14:42:41 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

commit 64f3755912bb85593f92a7e2e63810dbb3ab98ea
Author: Christian Grothoff <address@hidden>
AuthorDate: Mon Jan 23 11:13:55 2017 +0100

    allow more than one ACK being given to us at a time
---
 src/cadet/cadet_api.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index 750e70e29..872d414a7 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -268,7 +268,7 @@ struct GNUNET_CADET_Channel
   /**
    * Are we allowed to send to the service?
    */
-  int allow_send;
+  unsigned int allow_send;
 
 };
 
@@ -413,7 +413,6 @@ create_channel (struct GNUNET_CADET_Handle *h,
   {
     ch->ccn = ccn;
   }
-  ch->allow_send = GNUNET_NO;
   return ch;
 }
 
@@ -568,8 +567,10 @@ request_data (void *cls)
        "Requesting Data: %u bytes\n",
        th->size);
 
-  GNUNET_assert (GNUNET_YES == th->channel->allow_send);
-  th->channel->allow_send = GNUNET_NO;
+  GNUNET_assert (0 < th->channel->allow_send);
+  th->channel->allow_send--;
+  /* NOTE: we may be allowed to send another packet immediately,
+     albeit the current logic waits for the ACK. */
   th->request_data_task = NULL;
   th->channel->packet_size = 0;
   remove_from_queue (th);
@@ -621,7 +622,6 @@ handle_channel_created (void *cls,
     void *ctx;
 
     ch = create_channel (h, ccn);
-    ch->allow_send = GNUNET_NO;
     ch->peer = GNUNET_PEER_intern (&msg->peer);
     ch->cadet = h;
     ch->ccn = ccn;
@@ -801,21 +801,24 @@ handle_local_ack (void *cls,
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Got an ACK on channel %X!\n",
        ntohl (ch->ccn.channel_of_client));
-  ch->allow_send = GNUNET_YES;
+  ch->allow_send++;
   if (0 < ch->packet_size)
   {
     struct GNUNET_CADET_TransmitHandle *th;
     struct GNUNET_CADET_TransmitHandle *next;
+
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "  pending data, sending %u bytes!\n",
          ch->packet_size);
     for (th = h->th_head; NULL != th; th = next)
     {
       next = th->next;
-      if (th->channel == ch)
+      if ( (th->channel == ch) &&
+           (NULL == th->request_data_task) )
       {
-        GNUNET_assert (NULL == th->request_data_task);
-        th->request_data_task = GNUNET_SCHEDULER_add_now (&request_data, th);
+        th->request_data_task
+          = GNUNET_SCHEDULER_add_now (&request_data,
+                                      th);
         break;
       }
     }
@@ -1612,7 +1615,6 @@ GNUNET_CADET_channel_create (struct GNUNET_CADET_Handle 
*h,
   msg->port = *port;
   msg->peer = *peer;
   msg->opt = htonl (options);
-  ch->allow_send = GNUNET_NO;
   GNUNET_MQ_send (h->mq,
                   env);
   return ch;
@@ -1741,7 +1743,7 @@ GNUNET_CADET_notify_transmit_ready (struct 
GNUNET_CADET_Channel *channel,
   LOG (GNUNET_ERROR_TYPE_DEBUG, "    total size %u\n", th->size);
   th->notify = notify;
   th->notify_cls = notify_cls;
-  if (GNUNET_YES == channel->allow_send)
+  if (0 != channel->allow_send)
     th->request_data_task = GNUNET_SCHEDULER_add_now (&request_data, th);
   else
     add_to_queue (channel->cadet, th);

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]