update counters properly
authorChristian Grothoff <christian@grothoff.org>
Fri, 24 Feb 2017 12:25:56 +0000 (13:25 +0100)
committerChristian Grothoff <christian@grothoff.org>
Fri, 24 Feb 2017 12:26:38 +0000 (13:26 +0100)
src/cadet/gnunet-service-cadet-new_tunnels.c
src/transport/gnunet-service-transport_neighbours.c

index af77ea0673793768297922a4fb98f4d91ca8d553..05a1e071d6d350f38ee43b3eae0d7ca78b856967 100644 (file)
@@ -603,6 +603,7 @@ GCT_count_any_connections (const struct CadetTunnel *t)
 static struct CadetTConnection *
 get_ready_connection (struct CadetTunnel *t)
 {
+  GNUNET_assert (GNUNET_YES == t->connection_ready_head->is_ready);
   return t->connection_ready_head;
 }
 
@@ -1971,13 +1972,19 @@ GCT_connection_lost (struct CadetTConnection *ct)
   struct CadetTunnel *t = ct->t;
 
   if (GNUNET_YES == ct->is_ready)
+  {
     GNUNET_CONTAINER_DLL_remove (t->connection_ready_head,
                                  t->connection_ready_tail,
                                  ct);
+    t->num_ready_connections--;
+  }
   else
+  {
     GNUNET_CONTAINER_DLL_remove (t->connection_busy_head,
                                  t->connection_busy_tail,
                                  ct);
+    t->num_busy_connections--;
+  }
   GNUNET_free (ct);
 }
 
index 3952a728e6c4bd26fa8ee54bc156c76a622405fa..bbda715a24dd6ecbcf935540c8527e81d1307e9d 100644 (file)
@@ -1150,17 +1150,18 @@ set_incoming_quota (struct NeighbourMapEntry *n,
     sqm.header.size = htons (sizeof (struct GNUNET_ATS_SessionQuotaMessage));
     sqm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_QUOTA);
     sqm.quota = quota.value__;
-    (void) send_with_session (n,
-                              &sqm,
-                              sizeof (sqm),
-                              UINT32_MAX - 1,
-                              GNUNET_TIME_UNIT_FOREVER_REL,
-                              GNUNET_NO,
-                              NULL, NULL);
+    if (NULL != n->primary_address.session)
+      (void) send_with_session (n,
+                                &sqm,
+                                sizeof (sqm),
+                                UINT32_MAX - 1,
+                                GNUNET_TIME_UNIT_FOREVER_REL,
+                                GNUNET_NO,
+                                NULL, NULL);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-              "Disconnecting peer `%4s' due to SET_QUOTA\n",
+              "Disconnecting peer `%s' due to SET_QUOTA\n",
               GNUNET_i2s (&n->id));
   if (GNUNET_YES == test_connected (n))
     GNUNET_STATISTICS_update (GST_stats,