gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r36075 - gnunet/src/cadet


From: gnunet
Subject: [GNUnet-SVN] r36075 - gnunet/src/cadet
Date: Wed, 15 Jul 2015 13:45:12 +0200

Author: bartpolot
Date: 2015-07-15 13:45:11 +0200 (Wed, 15 Jul 2015)
New Revision: 36075

Modified:
   gnunet/src/cadet/gnunet-service-cadet_connection.c
   gnunet/src/cadet/gnunet-service-cadet_tunnel.c
   gnunet/src/cadet/gnunet-service-cadet_tunnel.h
Log:
- don't send KEEPALIVE if the tunnel has traffic queued

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2015-07-15 11:45:11 UTC 
(rev 36074)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2015-07-15 11:45:11 UTC 
(rev 36075)
@@ -1064,8 +1064,9 @@
        "keepalive %s for connection %s\n",
        GC_f2s (fwd), GCC_2s (c));
 
+  GNUNET_assert (NULL != c->t);
   fc = fwd ? &c->fwd_fc : &c->bck_fc;
-  if (0 < fc->queue_n)
+  if (0 < fc->queue_n || GNUNET_YES == GCT_has_queued_traffic (c->t))
   {
     LOG (GNUNET_ERROR_TYPE_INFO, "not sending keepalive, traffic in queue\n");
     return;

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2015-07-15 11:45:11 UTC 
(rev 36074)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2015-07-15 11:45:11 UTC 
(rev 36075)
@@ -3705,7 +3705,13 @@
   while (NULL != t->tq_head)
   {
     /* Should have been cleaned by destuction of channel. */
+    struct GNUNET_MessageHeader *mh;
+
     GNUNET_break (0);
+    mh = (struct GNUNET_MessageHeader *) &t->tq_head[1];
+    LOG (GNUNET_ERROR_TYPE_WARNING,
+         "message left behind on tunnel shutdown: %s\n",
+         GC_m2s (ntohs (mh->type)));
     unqueue_data (t->tq_head);
   }
 
@@ -4189,6 +4195,21 @@
 
 
 /**
+ * Check if the tunnel has queued traffic.
+ *
+ * @param t Tunnel to check.
+ *
+ * @return #GNUNET_YES if there is queued traffic
+ *         #GNUNET_NO otherwise
+ */
+int
+GCT_has_queued_traffic (struct CadetTunnel *t)
+{
+  return (NULL != t->tq_head) ? GNUNET_YES : GNUNET_NO;
+}
+
+
+/**
  * Sends an already built message on a tunnel, encrypting it and
  * choosing the best connection if not provided.
  *

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.h
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.h      2015-07-15 11:45:11 UTC 
(rev 36074)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.h      2015-07-15 11:45:11 UTC 
(rev 36075)
@@ -450,6 +450,17 @@
 
 
 /**
+ * Check if the tunnel has queued traffic.
+ *
+ * @param t Tunnel to check.
+ *
+ * @return #GNUNET_YES if there is queued traffic
+ *         #GNUNET_NO otherwise
+ */
+int
+GCT_has_queued_traffic (struct CadetTunnel *t);
+
+/**
  * Sends an already built message on a tunnel, encrypting it and
  * choosing the best connection.
  *




reply via email to

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