diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-11-09 20:37:11 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-11-09 20:37:11 +0000 |
commit | 887c426ffc3b37149431276cc19ab231baaac068 (patch) | |
tree | ad8395d3573710ec7b0f8e8b3a3fc86dd5c0600a /src | |
parent | 386e9b7031aae4f9f3bdbb2ca03a0d82a31f45c6 (diff) | |
download | gnunet-887c426ffc3b37149431276cc19ab231baaac068.tar.gz gnunet-887c426ffc3b37149431276cc19ab231baaac068.zip |
checking quotas
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/gnunet-service-ats_scheduling.c | 4 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 36 |
2 files changed, 23 insertions, 17 deletions
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 | |||
141 | addrp = (char *) &atsp[atsi_count]; | 141 | addrp = (char *) &atsp[atsi_count]; |
142 | memcpy (addrp, plugin_addr, plugin_addr_len); | 142 | memcpy (addrp, plugin_addr, plugin_addr_len); |
143 | strcpy (&addrp[plugin_addr_len], plugin_name); | 143 | strcpy (&addrp[plugin_addr_len], plugin_name); |
144 | |||
145 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ATS sends quota for peer `%s': (in/out) %u/%u\n", | ||
146 | GNUNET_i2s (peer), ntohl (bandwidth_in.value__), ntohl(bandwidth_out.value__)); | ||
147 | |||
144 | GNUNET_SERVER_notification_context_unicast (nc, my_client, &msg->header, | 148 | GNUNET_SERVER_notification_context_unicast (nc, my_client, &msg->header, |
145 | GNUNET_YES); | 149 | GNUNET_YES); |
146 | } | 150 | } |
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, | |||
1249 | (n->session == session) ) | 1249 | (n->session == session) ) |
1250 | { | 1250 | { |
1251 | struct QuotaSetMessage q_msg; | 1251 | struct QuotaSetMessage q_msg; |
1252 | 1252 | ||
1253 | #if DEBUG_TRANSPORT | ||
1254 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1255 | "Sending outbound quota of %u Bps and inbound quota of %u Bps for peer `%s' to all clients\n", | ||
1256 | ntohl (n->bandwidth_out.value__), | ||
1257 | ntohl (n->bandwidth_in.value__), GNUNET_i2s (peer)); | ||
1258 | #endif | ||
1259 | |||
1260 | n->bandwidth_in = bandwidth_in; | 1253 | n->bandwidth_in = bandwidth_in; |
1261 | n->bandwidth_out = bandwidth_out; | 1254 | n->bandwidth_out = bandwidth_out; |
1262 | GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in); | 1255 | GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in); |
1263 | 1256 | ||
1257 | #if DEBUG_TRANSPORT | ||
1258 | #endif | ||
1259 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1260 | "Sending outbound quota of %u Bps and inbound quota of %u Bps for peer `%s' to all clients\n", | ||
1261 | ntohl (n->bandwidth_out.value__), | ||
1262 | ntohl (n->bandwidth_in.value__), GNUNET_i2s (peer)); | ||
1263 | |||
1264 | q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); | 1264 | q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); |
1265 | q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); | 1265 | q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); |
1266 | q_msg.quota = n->bandwidth_out; | 1266 | q_msg.quota = n->bandwidth_out; |
@@ -1794,6 +1794,10 @@ GST_neighbours_set_incoming_quota (const struct GNUNET_PeerIdentity *neighbour, | |||
1794 | 1, GNUNET_NO); | 1794 | 1, GNUNET_NO); |
1795 | return; | 1795 | return; |
1796 | } | 1796 | } |
1797 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1798 | "Setting inbound quota of %u Bps for peer `%s' to all clients\n", | ||
1799 | ntohl (quota.value__), GNUNET_i2s (&n->id)); | ||
1800 | |||
1797 | GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, quota); | 1801 | GNUNET_BANDWIDTH_tracker_update_quota (&n->in_tracker, quota); |
1798 | if (0 != ntohl (quota.value__)) | 1802 | if (0 != ntohl (quota.value__)) |
1799 | return; | 1803 | return; |
@@ -2043,11 +2047,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | |||
2043 | n->session, | 2047 | n->session, |
2044 | GNUNET_YES); | 2048 | GNUNET_YES); |
2045 | GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_YES); | 2049 | GNUNET_ATS_address_in_use (GST_ats, n->address, n->session, GNUNET_YES); |
2046 | #if DEBUG_TRANSPORT | 2050 | |
2047 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
2048 | "Setting inbound quota of %u for peer `%s' to \n", | ||
2049 | ntohl (n->bandwidth_in.value__), GNUNET_i2s (&n->id)); | ||
2050 | #endif | ||
2051 | GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in); | 2051 | GST_neighbours_set_incoming_quota (&n->id, n->bandwidth_in); |
2052 | 2052 | ||
2053 | /* send ACK (ACK) */ | 2053 | /* send ACK (ACK) */ |
@@ -2086,10 +2086,11 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message, | |||
2086 | connect_notify_cb (callback_cls, &n->id, ats, ats_count); | 2086 | connect_notify_cb (callback_cls, &n->id, ats, ats_count); |
2087 | 2087 | ||
2088 | #if DEBUG_TRANSPORT | 2088 | #if DEBUG_TRANSPORT |
2089 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2089 | #endif |
2090 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
2090 | "Sending outbound quota of %u Bps for peer `%s' to all clients\n", | 2091 | "Sending outbound quota of %u Bps for peer `%s' to all clients\n", |
2091 | ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer)); | 2092 | ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer)); |
2092 | #endif | 2093 | |
2093 | q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); | 2094 | q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); |
2094 | q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); | 2095 | q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); |
2095 | q_msg.quota = n->bandwidth_out; | 2096 | q_msg.quota = n->bandwidth_out; |
@@ -2170,10 +2171,11 @@ GST_neighbours_handle_ack (const struct GNUNET_MessageHeader *message, | |||
2170 | #endif | 2171 | #endif |
2171 | connect_notify_cb (callback_cls, &n->id, ats, ats_count); | 2172 | connect_notify_cb (callback_cls, &n->id, ats, ats_count); |
2172 | #if DEBUG_TRANSPORT | 2173 | #if DEBUG_TRANSPORT |
2173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2174 | #endif |
2175 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
2174 | "Sending outbound quota of %u Bps for peer `%s' to all clients\n", | 2176 | "Sending outbound quota of %u Bps for peer `%s' to all clients\n", |
2175 | ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer)); | 2177 | ntohl (n->bandwidth_out.value__), GNUNET_i2s (peer)); |
2176 | #endif | 2178 | |
2177 | q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); | 2179 | q_msg.header.size = htons (sizeof (struct QuotaSetMessage)); |
2178 | q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); | 2180 | q_msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA); |
2179 | q_msg.quota = n->bandwidth_out; | 2181 | q_msg.quota = n->bandwidth_out; |