gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r36749 - gnunet/src/cadet
Date: Wed, 9 Dec 2015 19:56:41 +0100

Author: bartpolot
Date: 2015-12-09 19:56:41 +0100 (Wed, 09 Dec 2015)
New Revision: 36749

Modified:
   gnunet/src/cadet/gnunet-service-cadet_connection.c
Log:
Another attampt at fixing #4010: mark unavailable neighbors in FlowControl 
struct, test on POLL

Modified: gnunet/src/cadet/gnunet-service-cadet_connection.c
===================================================================
--- gnunet/src/cadet/gnunet-service-cadet_connection.c  2015-12-09 18:56:40 UTC 
(rev 36748)
+++ gnunet/src/cadet/gnunet-service-cadet_connection.c  2015-12-09 18:56:41 UTC 
(rev 36749)
@@ -71,6 +71,7 @@
 
   /**
    * How many messages do we accept in the queue.
+   * If 0, the connection is broken in this direction (next hop disconnected).
    */
   unsigned int queue_max;
 
@@ -1412,6 +1413,11 @@
     LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL canceled on shutdown\n");
     return;
   }
+  if (0 == fc->queue_max)
+  {
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL cancelled: neighbor disconnected\n");
+    return;
+  }
   LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL sent for %s, scheduling new one!\n",
        GCC_2s (c));
   GNUNET_assert (NULL == fc->poll_task);
@@ -3318,6 +3324,7 @@
 void
 GCC_neighbor_disconnected (struct CadetConnection *c, struct CadetPeer *peer)
 {
+  struct CadetFlowControl *fc;
   struct CadetPeer *hop;
   char peer_name[16];
   int fwd;
@@ -3348,7 +3355,12 @@
     GCC_check_connections ();
     return;
   }
+  /* Mark FlowControl towards the peer as unavaliable. */
+  fc = fwd ? &c->bck_fc : &c->fwd_fc;
+  fc->queue_max = 0;
+
   send_broken (c, &my_full_id, GCP_get_id (peer), fwd);
+
   /* Connection will have at least one pending message
    * (the one we just scheduled), so delay destruction
    * and remove from map so we don't use accidentally. */
@@ -3735,6 +3747,13 @@
          fc->poll_task, fc->poll_msg);
     return;
   }
+  if (0 == fc->queue_max)
+  {
+    /* Should not be needed, traffic should've been cancelled. */
+    GNUNET_break (0);
+    LOG (GNUNET_ERROR_TYPE_DEBUG, "  POLL not possible, peer disconnected\n");
+    return;
+  }
   LOG (GNUNET_ERROR_TYPE_DEBUG, "POLL started on request\n");
   fc->poll_task = GNUNET_SCHEDULER_add_delayed (fc->poll_time,
                                                 &connection_poll,




reply via email to

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