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);
}
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
&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.
*