From: Matthias Wachs Date: Wed, 9 Nov 2011 20:37:11 +0000 (+0000) Subject: checking quotas X-Git-Tag: initial-import-from-subversion-38251~15976 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=887c426ffc3b37149431276cc19ab231baaac068;p=oweals%2Fgnunet.git checking quotas --- diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c index d289ae594..493ff840f 100644 --- a/src/ats/gnunet-service-ats_scheduling.c +++ b/src/ats/gnunet-service-ats_scheduling.c @@ -141,6 +141,10 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity addrp = (char *) &atsp[atsi_count]; memcpy (addrp, plugin_addr, plugin_addr_len); strcpy (&addrp[plugin_addr_len], plugin_name); + + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ATS sends quota for peer `%s': (in/out) %u/%u\n", + GNUNET_i2s (peer), ntohl (bandwidth_in.value__), ntohl(bandwidth_out.value__)); + GNUNET_SERVER_notification_context_unicast (nc, my_client, &msg->header, GNUNET_YES); } diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 31dd07791..629cecefa 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -1249,18 +1249,18 @@ GST_neighbours_switch_to_address_3way (const struct GNUNET_PeerIdentity *peer, (n->session == session) ) { struct QuotaSetMessage q_msg; - -#if DEBUG_TRANSPORT - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Sending outbound quota of %u Bps and inbound quota of %u Bps for peer `%s' to all clients\n", - ntohl (n->bandwidth_out.value__), - ntohl (n->bandwidth_in.value__), GNUNET_i2s (peer)); -#endif - + n->bandwidth_in = bandwidth_in; n->bandwidth_out = bandwidth_out; GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in); +#if DEBUG_TRANSPORT +#endif + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Sending outbound quota of %u Bps and inbound quota of %u Bps for peer `%s' to all clients\n", + ntohl (n->bandwidth_out.value__), + ntohl (n->bandwidth_in.value__), GNUNET_i2s (peer)); + q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); q_msg.quota = n->bandwidth_out; @@ -1794,6 +1794,10 @@ GST_neighbours_set_incoming_quota (const struct GNUNET_PeerIdentity *neighbour, 1, GNUNET_NO); return; } + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Setting inbound quota of %u Bps for peer `%s' to all clients\n", + ntohl (quota.value__), GNUNET_i2s (&n->id)); + GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, quota); if (0 != ntohl (quota.value__)) return; @@ -2043,11 +2047,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, n->session, GNUNET_YES); GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_YES); -#if DEBUG_TRANSPORT - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Setting inbound quota of %u for peer `%s' to \n", - ntohl (n->bandwidth_in.value__), GNUNET_i2s (&n->id)); -#endif + GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in); /* send ACK (ACK) */ @@ -2086,10 +2086,11 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, connect_notify_cb (callback_cls, &n->id, ats, ats_count); #if DEBUG_TRANSPORT - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, +#endif + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Sending outbound quota of %u Bps for peer `%s' to all clients\n", ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer)); -#endif + q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); q_msg.quota = n->bandwidth_out; @@ -2170,10 +2171,11 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message, #endif connect_notify_cb (callback_cls, &n->id, ats, ats_count); #if DEBUG_TRANSPORT - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, +#endif + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Sending outbound quota of %u Bps for peer `%s' to all clients\n", ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer)); -#endif + q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); q_msg.quota = n->bandwidth_out;