From 246da91802a5dbb88ae09132d73787930f5f7f46 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Thu, 21 Mar 2013 13:45:09 +0000 Subject: [PATCH] changes to connect_cb --- src/transport/gnunet-service-transport.c | 12 +----------- src/transport/gnunet-service-transport_blacklist.c | 2 -- src/transport/gnunet-service-transport_clients.c | 13 ++----------- src/transport/gnunet-service-transport_neighbours.c | 6 +++--- src/transport/gnunet-service-transport_neighbours.h | 2 -- src/transport/test_transport_startonly.c | 3 +-- src/transport/transport.h | 10 ---------- src/transport/transport_api.c | 9 ++------- 8 files changed, 9 insertions(+), 48 deletions(-) diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index a0568c855..ffe40f8c1 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -111,8 +111,6 @@ struct GNUNET_TIME_Relative hello_expiration; */ static void transmit_our_hello (void *cls, const struct GNUNET_PeerIdentity *target, - const struct GNUNET_ATS_Information *ats, - uint32_t ats_count, const struct GNUNET_HELLO_Address *address, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) @@ -499,17 +497,12 @@ ats_request_address_change (void *cls, static void neighbours_connect_notification (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *ats, - uint32_t ats_count, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) { - size_t len = - sizeof (struct ConnectInfoMessage) + - ats_count * sizeof (struct GNUNET_ATS_Information); + size_t len = sizeof (struct ConnectInfoMessage); char buf[len] GNUNET_ALIGN; struct ConnectInfoMessage *connect_msg = (struct ConnectInfoMessage *) buf; - struct GNUNET_ATS_Information *ap; connections++; GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -518,12 +511,9 @@ neighbours_connect_notification (void *cls, connect_msg->header.size = htons (sizeof (buf)); connect_msg->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); - connect_msg->ats_count = htonl (ats_count); connect_msg->id = *peer; connect_msg->quota_in = bandwidth_in; connect_msg->quota_out = bandwidth_out; - ap = (struct GNUNET_ATS_Information *) &connect_msg[1]; - memcpy (ap, ats, ats_count * sizeof (struct GNUNET_ATS_Information)); GST_clients_broadcast (&connect_msg->header, GNUNET_NO); } diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index 479b30eb4..73dbd931d 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c @@ -548,8 +548,6 @@ struct TestConnectionContext */ static void test_connection_ok (void *cls, const struct GNUNET_PeerIdentity *neighbour, - const struct GNUNET_ATS_Information *ats, - uint32_t ats_count, const struct GNUNET_HELLO_Address *address, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index 23fc7278b..610dda021 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c @@ -474,30 +474,22 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client) static void notify_client_about_neighbour (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *ats, - uint32_t ats_count, const struct GNUNET_HELLO_Address *address, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) { struct TransportClient *tc = cls; struct ConnectInfoMessage *cim; - struct GNUNET_ATS_Information *ap; - size_t size = - sizeof (struct ConnectInfoMessage) + - ats_count * sizeof (struct GNUNET_ATS_Information); + size_t size = sizeof (struct ConnectInfoMessage); char buf[size] GNUNET_ALIGN; GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE); cim = (struct ConnectInfoMessage *) buf; cim->header.size = htons (size); cim->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); - cim->ats_count = htonl (ats_count); cim->id = *peer; cim->quota_in = bandwidth_in; cim->quota_out = bandwidth_out; - ap = (struct GNUNET_ATS_Information *) &cim[1]; - memcpy (ap, ats, ats_count * sizeof (struct GNUNET_ATS_Information)); unicast (tc, &cim->header, GNUNET_NO); } @@ -898,7 +890,6 @@ compose_address_iterate_response_message (const struct GNUNET_PeerIdentity */ static void output_address (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *ats, uint32_t ats_count, const struct GNUNET_HELLO_Address *address, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) @@ -965,7 +956,7 @@ clients_handle_address_iterate (void *cls, struct GNUNET_SERVER_Client *client, /* just return one neighbour */ address = GST_neighbour_get_current_address (&msg->peer); if (address != NULL) - output_address (tc, &msg->peer, NULL, 0, address, + output_address (tc, &msg->peer, address, GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT, GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT); } diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 2b010732d..ee23af7fc 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -2800,7 +2800,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, gettext_noop ("# peers connected"), ++neighbours_connected, GNUNET_NO); - connect_notify_cb (callback_cls, &n->id, NULL, 0, + connect_notify_cb (callback_cls, &n->id, n->primary_address.bandwidth_in, n->primary_address.bandwidth_out); /* Tell ATS that the outbound session we created to send CONNECT was successfull */ @@ -3059,7 +3059,7 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message, gettext_noop ("# peers connected"), ++neighbours_connected, GNUNET_NO); - connect_notify_cb (callback_cls, &n->id, NULL, 0, + connect_notify_cb (callback_cls, &n->id, n->primary_address.bandwidth_in, n->primary_address.bandwidth_out); GNUNET_ATS_address_add(GST_ats, @@ -3244,7 +3244,7 @@ neighbours_iterate (void *cls, const struct GNUNET_HashCode * key, void *value) bandwidth_out = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; } - ic->cb (ic->cb_cls, &n->id, NULL, 0, + ic->cb (ic->cb_cls, &n->id, n->primary_address.address, bandwidth_in, bandwidth_out); } diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h index 70b6d1096..fbf7d7819 100644 --- a/src/transport/gnunet-service-transport_neighbours.h +++ b/src/transport/gnunet-service-transport_neighbours.h @@ -177,8 +177,6 @@ GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target); typedef void (*GST_NeighbourIterator) (void *cls, const struct GNUNET_PeerIdentity * neighbour, - const struct GNUNET_ATS_Information * - ats, uint32_t ats_count, const struct GNUNET_HELLO_Address * address, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, diff --git a/src/transport/test_transport_startonly.c b/src/transport/test_transport_startonly.c index 8a8fef161..8593b897c 100644 --- a/src/transport/test_transport_startonly.c +++ b/src/transport/test_transport_startonly.c @@ -97,8 +97,7 @@ notify_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) static void notify_receive (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_MessageHeader *message, - const struct GNUNET_ATS_Information *ats, uint32_t ats_count) + const struct GNUNET_MessageHeader *message) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receiving\n"); } diff --git a/src/transport/transport.h b/src/transport/transport.h index d5413f779..f1376f5a7 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -68,8 +68,6 @@ * * @param cls closure * @param peer the peer that connected - * @param ats performance data - * @param ats_count number of entries in ats (excluding 0-termination) * @param bandwidth_in inbound bandwidth in NBO * @param bandwidth_out outbound bandwidth in NBO * @@ -77,8 +75,6 @@ typedef void (*NotifyConnect) (void *cls, const struct GNUNET_PeerIdentity *peer, - const struct GNUNET_ATS_Information *ats, - uint32_t ats_count, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out); @@ -125,12 +121,6 @@ struct ConnectInfoMessage */ struct GNUNET_MessageHeader header; - /** - * Number of ATS key-value pairs that follow this struct - * (excluding the 0-terminator). - */ - uint32_t ats_count GNUNET_PACKED; - /** * Identity of the new neighbour. */ diff --git a/src/transport/transport_api.c b/src/transport/transport_api.c index 8b66fb986..48285302a 100644 --- a/src/transport/transport_api.c +++ b/src/transport/transport_api.c @@ -475,13 +475,11 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) const struct GNUNET_MessageHeader *imm; const struct SendOkMessage *okm; const struct QuotaSetMessage *qm; - const struct GNUNET_ATS_Information *ats; struct GNUNET_TRANSPORT_GetHelloHandle *hwl; struct GNUNET_TRANSPORT_GetHelloHandle *next_hwl; struct Neighbour *n; struct GNUNET_PeerIdentity me; uint16_t size; - uint32_t ats_count; uint32_t bytes_msg; uint32_t bytes_physical; @@ -533,15 +531,12 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) break; } cim = (const struct ConnectInfoMessage *) msg; - ats_count = ntohl (cim->ats_count); if (size != - sizeof (struct ConnectInfoMessage) + - ats_count * sizeof (struct GNUNET_ATS_Information)) + sizeof (struct ConnectInfoMessage)) { GNUNET_break (0); break; } - ats = (const struct GNUNET_ATS_Information *) &cim[1]; LOG (GNUNET_ERROR_TYPE_DEBUG, "Receiving `%s' message for `%4s'.\n", "CONNECT", GNUNET_i2s (&cim->id)); n = neighbour_find (h, &cim->id); @@ -555,7 +550,7 @@ demultiplexer (void *cls, const struct GNUNET_MessageHeader *msg) "CONNECT", GNUNET_i2s (&cim->id), ntohl (cim->quota_out.value__)); GNUNET_BANDWIDTH_tracker_update_quota (&n->out_tracker, cim->quota_out); if (h->nc_cb != NULL) - h->nc_cb (h->cls, &n->id, ats, ats_count); + h->nc_cb (h->cls, &n->id, NULL, 0); break; case GNUNET_MESSAGE_TYPE_TRANSPORT_DISCONNECT: if (size != sizeof (struct DisconnectInfoMessage)) -- 2.25.1