gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30716 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r30716 - gnunet/src/mesh
Date: Fri, 15 Nov 2013 13:16:12 +0100

Author: bartpolot
Date: 2013-11-15 13:16:11 +0100 (Fri, 15 Nov 2013)
New Revision: 30716

Modified:
   gnunet/src/mesh/gnunet-service-mesh_channel.c
Log:
- dont allow a client to send more data when output buffer is full


Modified: gnunet/src/mesh/gnunet-service-mesh_channel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-11-15 09:57:59 UTC 
(rev 30715)
+++ gnunet/src/mesh/gnunet-service-mesh_channel.c       2013-11-15 12:16:11 UTC 
(rev 30716)
@@ -1277,12 +1277,13 @@
 GMCH_allow_client (struct MeshChannel *ch, int fwd)
 {
   struct MeshChannelReliability *rel;
+  unsigned int buffer;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG, "GMCH allow\n");
 
   if (MESH_CHANNEL_READY != ch->state)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, " not ready yet!\n");
+    LOG (GNUNET_ERROR_TYPE_DEBUG, " channel not ready yet!\n");
     return;
   }
 
@@ -1296,12 +1297,23 @@
     }
     if (NULL != rel->head_sent && 64 <= rel->mid_send - rel->head_sent->mid)
     {
-      LOG (GNUNET_ERROR_TYPE_DEBUG,
-           " too big mid gap! Wait for ACK.\n");
+      LOG (GNUNET_ERROR_TYPE_DEBUG, " too big MID gap! Wait for ACK.\n");
       return;
     }
   }
 
+  if (is_loopback (ch))
+    buffer = GMCH_get_buffer (ch, fwd);
+  else
+    buffer = GMT_get_connections_buffer (ch->t);
+
+  if (0 == buffer)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, " no buffer space.\n");
+    return;
+  }
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG, " buffer space %u, allowing\n", buffer);
   send_client_ack (ch, fwd);
 }
 




reply via email to

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