فهرست منبع

adding additional checks for invariants to help find #3690

Christian Grothoff 9 سال پیش
والد
کامیت
90c8b6d3ae
2فایلهای تغییر یافته به همراه13 افزوده شده و 1 حذف شده
  1. 12 0
      src/transport/gnunet-service-transport_neighbours.c
  2. 1 1
      src/transport/plugin_transport_http_client.c

+ 12 - 0
src/transport/gnunet-service-transport_neighbours.c

@@ -826,6 +826,9 @@ set_alternative_address (struct NeighbourMapEntry *n,
   n->alternative_address.session = session;
   n->alternative_address.ats_active = GNUNET_NO;
   n->alternative_address.keep_alive_nonce = 0;
+  GNUNET_assert (GNUNET_YES ==
+                 GST_ats_is_known (n->alternative_address.address,
+                                   n->alternative_address.session));
 }
 
 
@@ -890,6 +893,9 @@ set_primary_address (struct NeighbourMapEntry *n,
   n->primary_address.bandwidth_out = bandwidth_out;
   n->primary_address.session = session;
   n->primary_address.keep_alive_nonce = 0;
+  GNUNET_assert (GNUNET_YES ==
+                 GST_ats_is_known (n->primary_address.address,
+                                   n->primary_address.session));
   /* subsystems about address use */
   GST_validation_set_address_use (n->primary_address.address,
                                   GNUNET_YES);
@@ -2455,6 +2461,9 @@ try_run_fast_ats_update (const struct GNUNET_HELLO_Address *address,
     /* switch to a different session, but keeping same address; could
        happen if there is a 2nd inbound connection */
     n->primary_address.session = session;
+    GNUNET_assert (GNUNET_YES ==
+                   GST_ats_is_known (n->primary_address.address,
+                                     n->primary_address.session));
   }
   n->primary_address.bandwidth_in = bandwidth_in;
   n->primary_address.bandwidth_out = bandwidth_out;
@@ -3398,6 +3407,9 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
     /* Destroy the inbound address since it cannot be used */
     free_address (&n->primary_address);
     n->primary_address = n->alternative_address;
+    GNUNET_assert (GNUNET_YES ==
+                   GST_ats_is_known (n->primary_address.address,
+                                     n->primary_address.session));
     memset (&n->alternative_address,
             0,
             sizeof (struct NeighbourAddress));

+ 1 - 1
src/transport/plugin_transport_http_client.c

@@ -851,7 +851,7 @@ http_client_plugin_session_disconnect (void *cls,
   client_delete_session (s);
 
   /* Re-schedule since handles have changed */
-  if (plugin->client_perform_task != NULL)
+  if (NULL != plugin->client_perform_task)
   {
     GNUNET_SCHEDULER_cancel (plugin->client_perform_task);
     plugin->client_perform_task = NULL;