diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-11-20 08:00:46 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-11-20 08:00:46 +0000 |
commit | 3b014d6c7e60670d60286ffaef041cd26a7af542 (patch) | |
tree | 30e0f41d142a96c85a26ec79f4bbf2d6f7336acb /src/ats/gnunet-service-ats_performance.c | |
parent | 99d0b2ce7659f0dbe0d632d370a5fb8a9bb0f6c9 (diff) | |
download | gnunet-3b014d6c7e60670d60286ffaef041cd26a7af542.tar.gz gnunet-3b014d6c7e60670d60286ffaef041cd26a7af542.zip |
-changes
Diffstat (limited to 'src/ats/gnunet-service-ats_performance.c')
-rw-r--r-- | src/ats/gnunet-service-ats_performance.c | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c index ccc2446d9..7800ea46e 100644 --- a/src/ats/gnunet-service-ats_performance.c +++ b/src/ats/gnunet-service-ats_performance.c | |||
@@ -226,19 +226,21 @@ peerinfo_it (void *cls, | |||
226 | bandwidth_out, | 226 | bandwidth_out, |
227 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) | 227 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) |
228 | { | 228 | { |
229 | GNUNET_assert (NULL != cls); | 229 | struct PerformanceClient *pc = cls; |
230 | if (NULL != id) | 230 | GNUNET_assert (NULL != pc); |
231 | { | 231 | if (NULL == id) |
232 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for peer `%s' plugin `%s' BW out %llu, BW in %llu \n", | 232 | return; |
233 | GNUNET_i2s (id), | 233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
234 | plugin_name, ntohl (bandwidth_out.value__), ntohl (bandwidth_in.value__)); | 234 | "Callback for peer `%s' plugin `%s' BW out %llu, BW in %llu \n", |
235 | GAS_performance_notify_client(cls, | 235 | GNUNET_i2s (id), |
236 | id, | 236 | plugin_name, |
237 | plugin_name, plugin_addr, plugin_addr_len, | 237 | ntohl (bandwidth_out.value__), |
238 | atsi, atsi_count, | 238 | ntohl (bandwidth_in.value__)); |
239 | bandwidth_out, bandwidth_in); | 239 | GAS_performance_notify_client(pc, |
240 | } | 240 | id, |
241 | 241 | plugin_name, plugin_addr, plugin_addr_len, | |
242 | atsi, atsi_count, | ||
243 | bandwidth_out, bandwidth_in); | ||
242 | } | 244 | } |
243 | 245 | ||
244 | 246 | ||
@@ -295,11 +297,30 @@ void | |||
295 | GAS_handle_request_address_list (void *cls, struct GNUNET_SERVER_Client *client, | 297 | GAS_handle_request_address_list (void *cls, struct GNUNET_SERVER_Client *client, |
296 | const struct GNUNET_MessageHeader *message) | 298 | const struct GNUNET_MessageHeader *message) |
297 | { | 299 | { |
300 | struct PerformanceClient *pc; | ||
298 | struct AddressListRequestMessage * alrm = cls; | 301 | struct AddressListRequestMessage * alrm = cls; |
302 | struct GNUNET_PeerIdentity allzeros; | ||
299 | 303 | ||
300 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", | 304 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", |
301 | "ADDRESSLIST_REQUEST"); | 305 | "ADDRESSLIST_REQUEST"); |
302 | 306 | ||
307 | if (NULL == (pc = find_client(client))) | ||
308 | { | ||
309 | GNUNET_break (0); | ||
310 | return; | ||
311 | } | ||
312 | |||
313 | memset (&allzeros, '\0', sizeof (struct GNUNET_PeerIdentity)); | ||
314 | if (0 == memcmp (&alrm->peer, &allzeros, sizeof (struct GNUNET_PeerIdentity))) | ||
315 | { | ||
316 | /* Return addresses for all peers */ | ||
317 | GAS_addresses_iterate_peers (&peer_it, pc); | ||
318 | } | ||
319 | else | ||
320 | { | ||
321 | /* Return addresses for a specific peer */ | ||
322 | GAS_addresses_get_peer_info (&alrm->peer, &peerinfo_it, pc); | ||
323 | } | ||
303 | 324 | ||
304 | 325 | ||
305 | } | 326 | } |