gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r33989 - gnunet/src/cadet
Date: Mon, 21 Jul 2014 02:15:14 +0200

Author: bartpolot
Date: 2014-07-21 02:15:14 +0200 (Mon, 21 Jul 2014)
New Revision: 33989

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 re-encrypt data queued in a broken connection

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-21 00:15:13 UTC 
(rev 33988)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2014-07-21 00:15:14 UTC 
(rev 33989)
@@ -1839,9 +1839,7 @@
      * is popped! Do not use 'c' after the call. */
     while (NULL != (out_msg = GCP_connection_pop (neighbor, c)))
     {
-      GNUNET_assert (NULL ==
-                     GCT_send_prebuilt_message (out_msg, t, NULL, GNUNET_YES,
-                                                NULL, NULL));
+      GCT_resend_message (out_msg, t);
       pending_msgs--;
     }
 
@@ -3000,9 +2998,8 @@
     GNUNET_STATISTICS_update (stats, "# messages dropped (buffer full)",
                               1, GNUNET_NO);
     GNUNET_break (0);
-    LOG (GNUNET_ERROR_TYPE_DEBUG,
-                "queue full: %u/%u\n",
-                fc->queue_n, fc->queue_max);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "queue full: %u/%u\n",
+         fc->queue_n, fc->queue_max);
     if (GNUNET_MESSAGE_TYPE_CADET_ENCRYPTED == type)
     {
       fc->queue_n--;
@@ -3011,7 +3008,8 @@
     return NULL; /* Drop this message */
   }
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "  C_P+ %p %u\n", c, c->pending_messages);
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "  C_P+ %s %u\n",
+       GCC_2s (c), c->pending_messages);
   c->pending_messages++;
 
   q = GNUNET_new (struct CadetConnectionQueue);
@@ -3020,7 +3018,7 @@
                         size, c, fwd, &conn_message_sent, q);
   if (NULL == q->q)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING dropping msg on %s\n", GCC_2s (c));
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "dropping msg on %s, NULL q\n", GCC_2s (c));
     GNUNET_free (data);
     GNUNET_free (q);
     return NULL;

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-07-21 00:15:13 UTC 
(rev 33988)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.c      2014-07-21 00:15:14 UTC 
(rev 33989)
@@ -3039,7 +3039,33 @@
   return send_prebuilt_message (message, t, c, force, cont, cont_cls, NULL);
 }
 
+/**
+ * Sends an already built and encrypted message on a tunnel, choosing the best
+ * connection. Useful for re-queueing messages queued on a destroyed 
connection.
+ *
+ * @param message Message to send. Function modifies it.
+ * @param t Tunnel on which this message is transmitted.
+ */
+void
+GCT_resend_message (const struct GNUNET_MessageHeader *message,
+                    struct CadetTunnel *t)
+{
+  struct CadetConnection *c;
+  int fwd;
 
+  c = tunnel_get_connection (t);
+  if (NULL == c)
+  {
+    /* TODO queue in tunnel, marked as encrypted */
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "No connection available, dropping.\n");
+    return;
+  }
+  fwd = GCC_is_origin (c, GNUNET_YES);
+  GNUNET_break (NULL == GCC_send_prebuilt_message (message, 0, 0, c, fwd,
+                                                   GNUNET_YES, NULL, NULL));
+}
+
+
 /**
  * Is the tunnel directed towards the local peer?
  *

Modified: gnunet/src/cadet/gnunet-service-cadet_tunnel.h
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_tunnel.h      2014-07-21 00:15:13 UTC 
(rev 33988)
+++ gnunet/src/cadet/gnunet-service-cadet_tunnel.h      2014-07-21 00:15:14 UTC 
(rev 33989)
@@ -440,6 +440,17 @@
                            int force, GCT_sent cont, void *cont_cls);
 
 /**
+ * Sends an already built and encrypted message on a tunnel, choosing the best
+ * connection. Useful for re-queueing messages queued on a destroyed 
connection.
+ *
+ * @param message Message to send. Function modifies it.
+ * @param t Tunnel on which this message is transmitted.
+ */
+void
+GCT_resend_message (const struct GNUNET_MessageHeader *message,
+                    struct CadetTunnel *t);
+
+/**
  * Is the tunnel directed towards the local peer?
  *
  * @param t Tunnel.




reply via email to

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