transport metric manipulation
[oweals/gnunet.git] / src / transport / gnunet-service-transport_clients.c
index 764eff53144ae3d6ebf3a850034d564b55ba11ef..23fc7278b83af17a489a74138e7d24e4c0cf7b97 100644 (file)
@@ -30,6 +30,7 @@
 #include "gnunet-service-transport_neighbours.h"
 #include "gnunet-service-transport_plugins.h"
 #include "gnunet-service-transport_validation.h"
+#include "gnunet-service-transport_manipulation.h"
 #include "gnunet-service-transport.h"
 #include "transport.h"
 
@@ -281,6 +282,7 @@ setup_monitoring_client (struct GNUNET_SERVER_Client *client,
                          struct GNUNET_PeerIdentity *peer)
 {
   struct MonitoringClient *mc;
+  static struct GNUNET_PeerIdentity all_zeros;
 
   GNUNET_assert (lookup_monitoring_client (client) == NULL);
   mc = GNUNET_malloc (sizeof (struct MonitoringClient));
@@ -291,9 +293,13 @@ setup_monitoring_client (struct GNUNET_SERVER_Client *client,
                                mc);
   GNUNET_SERVER_notification_context_add (nc, client);
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Client %p started monitoring of the peer `%s'\n",
-              mc, GNUNET_i2s (peer));
+  if (0 != memcmp (peer, &all_zeros, sizeof (struct GNUNET_PeerIdentity)))
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Client %p started monitoring of the peer `%s'\n",
+                mc, GNUNET_i2s (peer));
+  else
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Client %p started monitoring all peers\n", mc);
   return mc;
 }
 
@@ -688,7 +694,7 @@ clients_handle_send (void *cls, struct GNUNET_SERVER_Client *client,
   stcc->target = obm->peer;
   stcc->client = client;
   GNUNET_SERVER_client_keep (client);
-  GST_neighbours_send (&obm->peer, obmm, msize,
+  GST_manipulation_send (&obm->peer, obmm, msize,
                        GNUNET_TIME_relative_ntoh (obm->timeout),
                        &handle_send_transmit_continuation, stcc);
 }
@@ -751,7 +757,6 @@ static void
 transmit_address_to_client (void *cls, const char *buf)
 {
   struct AddressToStringContext *actx = cls;
-
   if (NULL == buf)
   {
     GNUNET_SERVER_transmit_context_append_data (actx->tc, NULL, 0,
@@ -1002,6 +1007,8 @@ GST_clients_start (struct GNUNET_SERVER_Handle *server)
     {&GST_blacklist_handle_reply, NULL,
      GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY,
      sizeof (struct BlacklistMessage)},
+    {&GST_manipulation_set_metric, NULL,
+     GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC, 0},
     {NULL, NULL, 0, 0}
   };
   nc = GNUNET_SERVER_notification_context_create (server, 0);
@@ -1088,7 +1095,6 @@ GST_clients_broadcast_address_notification (const struct GNUNET_PeerIdentity
   struct AddressIterateResponseMessage *msg;
   struct MonitoringClient *mc;
   static struct GNUNET_PeerIdentity all_zeros;
-
   msg = compose_address_iterate_response_message (peer, address);
   mc = monitoring_clients_head;
   while (mc != NULL)