diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-16 10:10:59 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-16 10:10:59 +0000 |
commit | 1eef01cd60f92a3d77061d655c0217bd6f9ffce4 (patch) | |
tree | db83ba950eb0ece1efb9b682e379ccd1d0dd4b72 /src/ats/gnunet-service-ats_performance.c | |
parent | c1d89ed3cf92fa2492a5639e725aadd74742f135 (diff) | |
download | gnunet-1eef01cd60f92a3d77061d655c0217bd6f9ffce4.tar.gz gnunet-1eef01cd60f92a3d77061d655c0217bd6f9ffce4.zip |
notify performance monitors about destroyed addresses (for #3406)
Diffstat (limited to 'src/ats/gnunet-service-ats_performance.c')
-rw-r--r-- | src/ats/gnunet-service-ats_performance.c | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c index 2171ba697..16b6404d6 100644 --- a/src/ats/gnunet-service-ats_performance.c +++ b/src/ats/gnunet-service-ats_performance.c | |||
@@ -144,9 +144,12 @@ GAS_performance_remove_client (struct GNUNET_SERVER_Client *client) | |||
144 | * @param plugin_name 0-termintated string specifying the transport plugin | 144 | * @param plugin_name 0-termintated string specifying the transport plugin |
145 | * @param plugin_addr binary address for the plugin to use | 145 | * @param plugin_addr binary address for the plugin to use |
146 | * @param plugin_addr_len number of bytes in plugin_addr | 146 | * @param plugin_addr_len number of bytes in plugin_addr |
147 | * @param active is this address active | 147 | * @param active #GNUNET_YES if this address is actively used |
148 | * to maintain a connection to a peer; | ||
149 | * #GNUNET_NO if the address is not actively used; | ||
150 | * #GNUNET_SYSERR if this address is no longer available for ATS | ||
148 | * @param atsi performance data for the address | 151 | * @param atsi performance data for the address |
149 | * @param atsi_count number of performance records in 'ats' | 152 | * @param atsi_count number of performance records in @a atsi |
150 | * @param bandwidth_out assigned outbound bandwidth | 153 | * @param bandwidth_out assigned outbound bandwidth |
151 | * @param bandwidth_in assigned inbound bandwidth | 154 | * @param bandwidth_in assigned inbound bandwidth |
152 | */ | 155 | */ |
@@ -189,7 +192,7 @@ GAS_performance_notify_client (struct PerformanceClient *pc, | |||
189 | msg->ats_count = htonl (atsi_count); | 192 | msg->ats_count = htonl (atsi_count); |
190 | msg->peer = *peer; | 193 | msg->peer = *peer; |
191 | msg->address_length = htons (plugin_addr_len); | 194 | msg->address_length = htons (plugin_addr_len); |
192 | msg->address_active = ntohl (active); | 195 | msg->address_active = ntohl ((uint32_t) active); |
193 | msg->plugin_name_length = htons (plugin_name_length); | 196 | msg->plugin_name_length = htons (plugin_name_length); |
194 | msg->bandwidth_out = bandwidth_out; | 197 | msg->bandwidth_out = bandwidth_out; |
195 | msg->bandwidth_in = bandwidth_in; | 198 | msg->bandwidth_in = bandwidth_in; |
@@ -213,7 +216,10 @@ GAS_performance_notify_client (struct PerformanceClient *pc, | |||
213 | * @param plugin_name 0-termintated string specifying the transport plugin | 216 | * @param plugin_name 0-termintated string specifying the transport plugin |
214 | * @param plugin_addr binary address for the plugin to use | 217 | * @param plugin_addr binary address for the plugin to use |
215 | * @param plugin_addr_len number of bytes in @a plugin_addr | 218 | * @param plugin_addr_len number of bytes in @a plugin_addr |
216 | * @param active is this address active | 219 | * @param active #GNUNET_YES if this address is actively used |
220 | * to maintain a connection to a peer; | ||
221 | * #GNUNET_NO if the address is not actively used; | ||
222 | * #GNUNET_SYSERR if this address is no longer available for ATS | ||
217 | * @param atsi performance data for the address | 223 | * @param atsi performance data for the address |
218 | * @param atsi_count number of performance records in @a atsi | 224 | * @param atsi_count number of performance records in @a atsi |
219 | * @param bandwidth_out assigned outbound bandwidth | 225 | * @param bandwidth_out assigned outbound bandwidth |
@@ -259,7 +265,7 @@ GAS_performance_notify_all_clients (const struct GNUNET_PeerIdentity *peer, | |||
259 | * @param plugin_name plugin name | 265 | * @param plugin_name plugin name |
260 | * @param plugin_addr address | 266 | * @param plugin_addr address |
261 | * @param plugin_addr_len length of @a plugin_addr | 267 | * @param plugin_addr_len length of @a plugin_addr |
262 | * @param address_active is address actively used | 268 | * @param active is address actively used |
263 | * @param atsi ats performance information | 269 | * @param atsi ats performance information |
264 | * @param atsi_count number of ats performance elements in @a atsi | 270 | * @param atsi_count number of ats performance elements in @a atsi |
265 | * @param bandwidth_out current outbound bandwidth assigned to address | 271 | * @param bandwidth_out current outbound bandwidth assigned to address |
@@ -269,8 +275,9 @@ static void | |||
269 | peerinfo_it (void *cls, | 275 | peerinfo_it (void *cls, |
270 | const struct GNUNET_PeerIdentity *id, | 276 | const struct GNUNET_PeerIdentity *id, |
271 | const char *plugin_name, | 277 | const char *plugin_name, |
272 | const void *plugin_addr, size_t plugin_addr_len, | 278 | const void *plugin_addr, |
273 | const int active, | 279 | size_t plugin_addr_len, |
280 | int active, | ||
274 | const struct GNUNET_ATS_Information *atsi, | 281 | const struct GNUNET_ATS_Information *atsi, |
275 | uint32_t atsi_count, | 282 | uint32_t atsi_count, |
276 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 283 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
@@ -360,7 +367,7 @@ transmit_req_addr (struct AddressIteration *ai, | |||
360 | const struct GNUNET_PeerIdentity *id, | 367 | const struct GNUNET_PeerIdentity *id, |
361 | const char *plugin_name, | 368 | const char *plugin_name, |
362 | const void *plugin_addr, size_t plugin_addr_len, | 369 | const void *plugin_addr, size_t plugin_addr_len, |
363 | const int active, | 370 | int active, |
364 | const struct GNUNET_ATS_Information *atsi, | 371 | const struct GNUNET_ATS_Information *atsi, |
365 | uint32_t atsi_count, | 372 | uint32_t atsi_count, |
366 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 373 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
@@ -428,15 +435,14 @@ transmit_req_addr (struct AddressIteration *ai, | |||
428 | */ | 435 | */ |
429 | static void | 436 | static void |
430 | req_addr_peerinfo_it (void *cls, | 437 | req_addr_peerinfo_it (void *cls, |
431 | const struct GNUNET_PeerIdentity *id, | 438 | const struct GNUNET_PeerIdentity *id, |
432 | const char *plugin_name, | 439 | const char *plugin_name, |
433 | const void *plugin_addr, size_t plugin_addr_len, | 440 | const void *plugin_addr, size_t plugin_addr_len, |
434 | const int active, | 441 | int active, |
435 | const struct GNUNET_ATS_Information *atsi, | 442 | const struct GNUNET_ATS_Information *atsi, |
436 | uint32_t atsi_count, | 443 | uint32_t atsi_count, |
437 | struct GNUNET_BANDWIDTH_Value32NBO | 444 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
438 | bandwidth_out, | 445 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) |
439 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) | ||
440 | { | 446 | { |
441 | struct AddressIteration *ai = cls; | 447 | struct AddressIteration *ai = cls; |
442 | 448 | ||
@@ -515,7 +521,8 @@ req_addr_peer_it (void *cls, | |||
515 | * @param message the request message | 521 | * @param message the request message |
516 | */ | 522 | */ |
517 | void | 523 | void |
518 | GAS_handle_request_address_list (void *cls, struct GNUNET_SERVER_Client *client, | 524 | GAS_handle_request_address_list (void *cls, |
525 | struct GNUNET_SERVER_Client *client, | ||
519 | const struct GNUNET_MessageHeader *message) | 526 | const struct GNUNET_MessageHeader *message) |
520 | { | 527 | { |
521 | struct PerformanceClient *pc; | 528 | struct PerformanceClient *pc; |
@@ -568,15 +575,21 @@ void | |||
568 | GAS_handle_performance_update (struct GNUNET_PeerIdentity *peer, | 575 | GAS_handle_performance_update (struct GNUNET_PeerIdentity *peer, |
569 | const char *plugin_name, | 576 | const char *plugin_name, |
570 | const void *plugin_addr, size_t plugin_addr_len, | 577 | const void *plugin_addr, size_t plugin_addr_len, |
571 | const int active, | 578 | int active, |
572 | struct GNUNET_ATS_Information *ats, | 579 | struct GNUNET_ATS_Information *ats, |
573 | uint32_t ats_count, | 580 | uint32_t ats_count, |
574 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 581 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
575 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) | 582 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in) |
576 | { | 583 | { |
577 | /* Notify here */ | 584 | /* Notify here */ |
578 | GAS_performance_notify_all_clients (peer, plugin_name, plugin_addr, | 585 | GAS_performance_notify_all_clients (peer, |
579 | plugin_addr_len, active, ats, ats_count, bandwidth_out, bandwidth_in); | 586 | plugin_name, |
587 | plugin_addr, | ||
588 | plugin_addr_len, | ||
589 | active, | ||
590 | ats, ats_count, | ||
591 | bandwidth_out, | ||
592 | bandwidth_in); | ||
580 | 593 | ||
581 | #if 0 | 594 | #if 0 |
582 | struct PerformanceClient *cur; | 595 | struct PerformanceClient *cur; |
@@ -617,7 +630,8 @@ GAS_handle_performance_update (struct GNUNET_PeerIdentity *peer, | |||
617 | * @param message the request message | 630 | * @param message the request message |
618 | */ | 631 | */ |
619 | void | 632 | void |
620 | GAS_handle_reservation_request (void *cls, struct GNUNET_SERVER_Client *client, | 633 | GAS_handle_reservation_request (void *cls, |
634 | struct GNUNET_SERVER_Client *client, | ||
621 | const struct GNUNET_MessageHeader *message) | 635 | const struct GNUNET_MessageHeader *message) |
622 | { | 636 | { |
623 | const struct ReservationRequestMessage *msg = | 637 | const struct ReservationRequestMessage *msg = |