gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r28801 - gnunet/src/mesh
Date: Thu, 22 Aug 2013 19:01:28 +0200

Author: bartpolot
Date: 2013-08-22 19:01:28 +0200 (Thu, 22 Aug 2013)
New Revision: 28801

Modified:
   gnunet/src/mesh/gnunet-service-mesh-enc.c
Log:
- fixes


Modified: gnunet/src/mesh/gnunet-service-mesh-enc.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh-enc.c   2013-08-22 16:45:14 UTC (rev 
28800)
+++ gnunet/src/mesh/gnunet-service-mesh-enc.c   2013-08-22 17:01:28 UTC (rev 
28801)
@@ -1495,7 +1495,7 @@
 
 /**
  * Build a local ACK message and send it to a local client.
- * 
+ *
  * @param ch Channel on which to send the ACK.
  * @param c Client to whom send the ACK.
  * @param fwd Set to GNUNET_YES for FWD ACK (dest->owner)
@@ -1567,6 +1567,8 @@
   struct MeshFlowControl *fc;
   unsigned int lowest_q;
 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "tunnl_get_connection %s\n",
+              peer2s (t->peer));
   best = NULL;
   lowest_q = UINT_MAX;
   for (c = t->connection_head; NULL != c; c = c->next)
@@ -2440,6 +2442,29 @@
               "connection_unlock_queue %s on %s\n",
               fwd ? "FWD" : "BCK", GNUNET_h2s (&c->id));
 
+  if (connection_is_origin (c, fwd))
+  {
+    struct MeshTunnel2 *t = c->t;
+    struct MeshChannel *ch;
+
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " is origin!\n");
+    /* FIXME randomize channel selection, not always first channel */
+    for (ch = t->channel_head; NULL != ch; ch = ch->next)
+    {
+      int blocked = fwd ? ch->blocked_fwd : ch->blocked_bck;
+
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  channel %X - %s\n",
+                  ch->gid, blocked ? "blocked " : "not blocked");
+      if (blocked)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "    blocked!\n");
+        send_local_ack (ch, fwd ? ch->root : ch->dest, fwd);
+        return; /* FIXME authorize all channels? */
+      }
+    }
+    return;
+  }
+
   peer = connection_get_hop (c, fwd);
 
   if (NULL != peer->core_transmit)
@@ -3572,7 +3597,7 @@
  * Send an ACK to a client if needed.
  *
  * @param ch Channel this is regarding.
- * @param fwd Is this about fwd traffic? (ACk goes the opposite direction).
+ * @param fwd Is this about fwd traffic? (ACK goes the opposite direction).
  */
 static void
 channel_send_client_ack (struct MeshChannel *ch, int fwd)




reply via email to

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