aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-01-15 17:18:11 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-01-15 17:18:11 +0000
commit2368c95a00afc72a8f03ab67bca1ff41328eecdf (patch)
tree3bcbc29808d7e91c85ca60ac5c998374b458862e /src/transport/gnunet-service-transport.c
parentb0144a11f14f33ab010fd7cf8c61bdd361f20fd3 (diff)
downloadgnunet-2368c95a00afc72a8f03ab67bca1ff41328eecdf.tar.gz
gnunet-2368c95a00afc72a8f03ab67bca1ff41328eecdf.zip
transport validation monitoring API (not yet complete) + CLI
+ fix for crash in transport/plugin_transport_udp.c
Diffstat (limited to 'src/transport/gnunet-service-transport.c')
-rw-r--r--src/transport/gnunet-service-transport.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index d52d6ab69..66f177145 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -764,13 +764,43 @@ neighbours_changed_notification (void *cls,
764 "Notifying about change for peer `%s' with address `%s' in state `%s' timing out at %s\n", 764 "Notifying about change for peer `%s' with address `%s' in state `%s' timing out at %s\n",
765 GNUNET_i2s (peer), 765 GNUNET_i2s (peer),
766 (NULL != address) ? GST_plugins_a2s (address) : "<none>", 766 (NULL != address) ? GST_plugins_a2s (address) : "<none>",
767 GNUNET_TRANSPORT_p2s (state), 767 GNUNET_TRANSPORT_ps2s (state),
768 GNUNET_STRINGS_absolute_time_to_string (state_timeout)); 768 GNUNET_STRINGS_absolute_time_to_string (state_timeout));
769 769
770 GST_clients_broadcast_peer_notification (peer, address, state, state_timeout); 770 GST_clients_broadcast_peer_notification (peer, address, state, state_timeout);
771} 771}
772 772
773/** 773/**
774 * Function called to notify transport users that a neighbour peer changed its
775 * active address.
776 *
777 * @param cls closure
778 * @param peer peer this update is about (never NULL)
779 * @param address address, NULL on disconnect
780 * @param state current state this peer is in
781 * @param state_timeout timeout for the current state of the peer
782 * @param bandwidth_in bandwidth assigned inbound
783 * @param bandwidth_out bandwidth assigned outbound
784 */
785static void
786validation_changed_notification (void *cls,
787 const struct GNUNET_PeerIdentity *peer,
788 const struct GNUNET_HELLO_Address *address,
789 struct GNUNET_TIME_Absolute last_validation,
790 struct GNUNET_TIME_Absolute valid_until,
791 struct GNUNET_TIME_Absolute next_validation,
792 enum GNUNET_TRANSPORT_ValidationState state)
793{
794 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
795 "Notifying about change for for validation entry for peer `%s' with address `%s'\n",
796 GNUNET_i2s (peer),
797 (NULL != address) ? GST_plugins_a2s (address) : "<none>");
798
799 GST_clients_broadcast_validation_notification (peer, address,
800 last_validation, valid_until, next_validation, state);
801}
802
803/**
774 * Function called when the service shuts down. Unloads our plugins 804 * Function called when the service shuts down. Unloads our plugins
775 * and cancels pending validations. 805 * and cancels pending validations.
776 * 806 *
@@ -918,7 +948,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
918 &neighbours_disconnect_notification, &neighbours_changed_notification, 948 &neighbours_disconnect_notification, &neighbours_changed_notification,
919 (max_fd / 3) * 2); 949 (max_fd / 3) * 2);
920 GST_clients_start (GST_server); 950 GST_clients_start (GST_server);
921 GST_validation_start ((max_fd / 3)); 951 GST_validation_start (&validation_changed_notification, NULL, (max_fd / 3));
922} 952}
923 953
924/** 954/**