gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r34065 - gnunet/src/cadet
Date: Mon, 28 Jul 2014 07:12:41 +0200

Author: bartpolot
Date: 2014-07-28 07:12:40 +0200 (Mon, 28 Jul 2014)
New Revision: 34065

Modified:
   gnunet/src/cadet/gnunet-service-cadet_connection.c
Log:
Resend traffic queued on connections that time-out, if the peer is an endpoint.

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-28 05:12:39 UTC 
(rev 34064)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-28 05:12:40 UTC 
(rev 34065)
@@ -1282,6 +1282,34 @@
     return;
   }
 
+  if (GCC_is_origin (c, GNUNET_NO)) /* If dest, salvage queued traffic. */
+  {
+    struct GNUNET_MessageHeader *out_msg;
+    struct CadetPeer *neighbor;
+    struct CadetTunnel *t;
+    int destroyed;
+
+    t = c->t;
+    destroyed = GNUNET_NO;
+    neighbor = get_hop (c, GNUNET_NO);
+
+    /* GCP_connection_pop could destroy the connection! */
+    while (NULL != (out_msg = GCP_connection_pop (neighbor, c, &destroyed)))
+    {
+      GCT_resend_message (out_msg, t);
+    }
+    /* All pending messages should have been popped,
+     * and the connection destroyed by the continuation.
+     */
+    if (GNUNET_YES != destroyed)
+    {
+      GNUNET_break (0);
+      GCC_debug (c, GNUNET_ERROR_TYPE_ERROR);
+      GCC_destroy (c);
+    }
+    return;
+  }
+
   GCC_destroy (c);
 }
 
@@ -1290,6 +1318,8 @@
  * Timeout function due to lack of keepalive/traffic from the destination.
  * Destroys connection if called.
  *
+ * FIXME refactor and merge with connection_fwd_timeout.
+ *
  * @param cls Closure (connection to destroy).
  * @param tc TaskContext
  */
@@ -1312,6 +1342,34 @@
     return;
   }
 
+  if (GCC_is_origin (c, GNUNET_YES)) /* If dest, salvage queued traffic. */
+  {
+    struct GNUNET_MessageHeader *out_msg;
+    struct CadetPeer *neighbor;
+    struct CadetTunnel *t;
+    int destroyed;
+
+    t = c->t;
+    destroyed = GNUNET_NO;
+    neighbor = get_hop (c, GNUNET_YES);
+
+    /* GCP_connection_pop could destroy the connection! */
+    while (NULL != (out_msg = GCP_connection_pop (neighbor, c, &destroyed)))
+    {
+      GCT_resend_message (out_msg, t);
+    }
+    /* All pending messages should have been popped,
+     * and the connection destroyed by the continuation.
+     */
+    if (GNUNET_YES != destroyed)
+    {
+      GNUNET_break (0);
+      GCC_debug (c, GNUNET_ERROR_TYPE_ERROR);
+      GCC_destroy (c);
+    }
+    return;
+  }
+
   GCC_destroy (c);
 }
 




reply via email to

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