-fix time assertion introduce in last patch
[oweals/gnunet.git] / src / transport / gnunet-service-transport.c
index 66514b8e53f52cac4ecf7b3cfdc71429b4c7c3dd..a41aa7f65bca14ca98bf69895df3c8f1a424b90e 100644 (file)
@@ -537,6 +537,28 @@ static void
 plugin_env_address_change_notification (void *cls, int add_remove,
     const struct GNUNET_HELLO_Address *address)
 {
+  static int addresses = 0;
+  struct GNUNET_STATISTICS_Handle *cfg = GST_stats;
+
+  if (GNUNET_YES == add_remove)
+  {
+    addresses ++;
+    GNUNET_STATISTICS_update (cfg, "# transport addresses", 1, GNUNET_NO);
+  }
+  else if (GNUNET_NO == add_remove)
+  {
+    if (0 == addresses)
+      GNUNET_break (0);
+    else
+    {
+      addresses --;
+      GNUNET_STATISTICS_update (cfg, "# transport addresses", -1, GNUNET_NO);
+    }
+  }
+
+  GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+      "Transport now has %u addresses to communicate\n", addresses);
+
   GST_hello_modify_addresses (add_remove, address);
 }
 
@@ -987,35 +1009,6 @@ neighbours_changed_notification (void *cls,
   GST_clients_broadcast_peer_notification (peer, address, state, state_timeout);
 }
 
-/**
- * Function called to notify transport users that a neighbour peer changed its
- * active address.
- *
- * @param cls closure
- * @param peer peer this update is about (never NULL)
- * @param address address (never NULL)
- * @param last_validation point in time when last validation was performed
- * @param valid_until point in time how long address is valid
- * @param next_validation point in time when next validation will be performed
- * @param state state of validation notification
- */
-static void
-validation_changed_notification (void *cls,
-    const struct GNUNET_PeerIdentity *peer,
-    const struct GNUNET_HELLO_Address *address,
-    struct GNUNET_TIME_Absolute last_validation,
-    struct GNUNET_TIME_Absolute valid_until,
-    struct GNUNET_TIME_Absolute next_validation,
-    enum GNUNET_TRANSPORT_ValidationState state)
-{
-  GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
-      "Notifying about change for for validation entry for peer `%s' with address `%s'\n",
-      GNUNET_i2s (peer),
-      (NULL != address) ? GST_plugins_a2s (address) : "<none>");
-
-  GST_clients_broadcast_validation_notification (peer, address,
-      last_validation, valid_until, next_validation, state);
-}
 
 /**
  * Function called when the service shuts down.  Unloads our plugins
@@ -1169,9 +1162,10 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
       &neighbours_changed_notification,
       (max_fd / 3) * 2);
   GST_clients_start (GST_server);
-  GST_validation_start (&validation_changed_notification, NULL, (max_fd / 3));
+  GST_validation_start ((max_fd / 3));
 }
 
+
 /**
  * The main function for the transport service.
  *