diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-10 00:00:56 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-10 00:00:56 +0000 |
commit | e649f10af79eb62bdd1eb0d358538779e3f49235 (patch) | |
tree | 8a0a2e77305018be8dd5c85027018da09d569b2a /src/ats | |
parent | 98d966344028d236cc1296ec1fcedb8891774604 (diff) | |
download | gnunet-e649f10af79eb62bdd1eb0d358538779e3f49235.tar.gz gnunet-e649f10af79eb62bdd1eb0d358538779e3f49235.zip |
-fix
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/ats_api_connectivity.c | 21 | ||||
-rw-r--r-- | src/ats/ats_api_performance.c | 22 | ||||
-rw-r--r-- | src/ats/ats_api_scanner.c | 13 | ||||
-rw-r--r-- | src/ats/ats_api_scheduling.c | 68 |
4 files changed, 67 insertions, 57 deletions
diff --git a/src/ats/ats_api_connectivity.c b/src/ats/ats_api_connectivity.c index 432f1ca35..495a29d93 100644 --- a/src/ats/ats_api_connectivity.c +++ b/src/ats/ats_api_connectivity.c | |||
@@ -28,6 +28,9 @@ | |||
28 | #include "ats.h" | 28 | #include "ats.h" |
29 | 29 | ||
30 | 30 | ||
31 | #define LOG(kind,...) GNUNET_log_from(kind, "ats-connectivity-api", __VA_ARGS__) | ||
32 | |||
33 | |||
31 | /** | 34 | /** |
32 | * Handle for ATS address suggestion requests. | 35 | * Handle for ATS address suggestion requests. |
33 | */ | 36 | */ |
@@ -149,9 +152,9 @@ error_handler (void *cls, | |||
149 | { | 152 | { |
150 | struct GNUNET_ATS_ConnectivityHandle *ch = cls; | 153 | struct GNUNET_ATS_ConnectivityHandle *ch = cls; |
151 | 154 | ||
152 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 155 | LOG (GNUNET_ERROR_TYPE_WARNING, |
153 | "ATS connection died (code %d), reconnecting\n", | 156 | "ATS connection died (code %d), reconnecting\n", |
154 | (int) error); | 157 | (int) error); |
155 | force_reconnect (ch); | 158 | force_reconnect (ch); |
156 | } | 159 | } |
157 | 160 | ||
@@ -308,9 +311,9 @@ GNUNET_ATS_connectivity_suggest (struct GNUNET_ATS_ConnectivityHandle *ch, | |||
308 | { | 311 | { |
309 | struct GNUNET_ATS_ConnectivitySuggestHandle *s; | 312 | struct GNUNET_ATS_ConnectivitySuggestHandle *s; |
310 | 313 | ||
311 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 314 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
312 | "Requesting ATS to suggest address for `%s'\n", | 315 | "Requesting ATS to suggest address for `%s'\n", |
313 | GNUNET_i2s (peer)); | 316 | GNUNET_i2s (peer)); |
314 | s = GNUNET_new (struct GNUNET_ATS_ConnectivitySuggestHandle); | 317 | s = GNUNET_new (struct GNUNET_ATS_ConnectivitySuggestHandle); |
315 | s->ch = ch; | 318 | s->ch = ch; |
316 | s->id = *peer; | 319 | s->id = *peer; |
@@ -344,9 +347,9 @@ GNUNET_ATS_connectivity_suggest_cancel (struct GNUNET_ATS_ConnectivitySuggestHan | |||
344 | struct GNUNET_MQ_Envelope *ev; | 347 | struct GNUNET_MQ_Envelope *ev; |
345 | struct RequestAddressMessage *m; | 348 | struct RequestAddressMessage *m; |
346 | 349 | ||
347 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 350 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
348 | "Telling ATS we no longer care for an address for `%s'\n", | 351 | "Telling ATS we no longer care for an address for `%s'\n", |
349 | GNUNET_i2s (&sh->id)); | 352 | GNUNET_i2s (&sh->id)); |
350 | GNUNET_assert (GNUNET_OK == | 353 | GNUNET_assert (GNUNET_OK == |
351 | GNUNET_CONTAINER_multipeermap_remove (ch->sug_requests, | 354 | GNUNET_CONTAINER_multipeermap_remove (ch->sug_requests, |
352 | &sh->id, | 355 | &sh->id, |
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c index e81f0d394..51980f079 100644 --- a/src/ats/ats_api_performance.c +++ b/src/ats/ats_api_performance.c | |||
@@ -27,6 +27,10 @@ | |||
27 | #include "gnunet_ats_service.h" | 27 | #include "gnunet_ats_service.h" |
28 | #include "ats.h" | 28 | #include "ats.h" |
29 | 29 | ||
30 | |||
31 | #define LOG(kind,...) GNUNET_log_from(kind, "ats-performance-api", __VA_ARGS__) | ||
32 | |||
33 | |||
30 | /** | 34 | /** |
31 | * Message in linked list we should send to the ATS service. The | 35 | * Message in linked list we should send to the ATS service. The |
32 | * actual binary message follows this struct. | 36 | * actual binary message follows this struct. |
@@ -520,11 +524,10 @@ process_ar_message (struct GNUNET_ATS_PerformanceHandle *ph, | |||
520 | GNUNET_break(0); | 524 | GNUNET_break(0); |
521 | return GNUNET_SYSERR; | 525 | return GNUNET_SYSERR; |
522 | } | 526 | } |
523 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 527 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
524 | "Received %s message for peer %s and plugin %s\n", | 528 | "Received ATS_ADDRESSLIST_RESPONSE message for peer %s and plugin %s\n", |
525 | "ATS_ADDRESSLIST_RESPONSE", | 529 | GNUNET_i2s (&pi->peer), |
526 | GNUNET_i2s (&pi->peer), | 530 | plugin_name); |
527 | plugin_name); | ||
528 | 531 | ||
529 | next = ph->addresslist_head; | 532 | next = ph->addresslist_head; |
530 | while (NULL != (alh = next)) | 533 | while (NULL != (alh = next)) |
@@ -546,9 +549,8 @@ process_ar_message (struct GNUNET_ATS_PerformanceHandle *ph, | |||
546 | (0 == ats_count) ) | 549 | (0 == ats_count) ) |
547 | { | 550 | { |
548 | /* Done */ | 551 | /* Done */ |
549 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 552 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
550 | "Received last message for %s\n", | 553 | "Received last message for ATS_ADDRESSLIST_RESPONSE\n"); |
551 | "ATS_ADDRESSLIST_RESPONSE"); | ||
552 | bandwidth_zero.value__ = htonl (0); | 554 | bandwidth_zero.value__ = htonl (0); |
553 | GNUNET_CONTAINER_DLL_remove (ph->addresslist_head, | 555 | GNUNET_CONTAINER_DLL_remove (ph->addresslist_head, |
554 | ph->addresslist_tail, | 556 | ph->addresslist_tail, |
@@ -622,8 +624,8 @@ process_ats_message (void *cls, | |||
622 | return; | 624 | return; |
623 | 625 | ||
624 | reconnect: | 626 | reconnect: |
625 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 627 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
626 | "Reconnecting!\n"); | 628 | "Reconnecting!\n"); |
627 | if (NULL != ph->th) | 629 | if (NULL != ph->th) |
628 | { | 630 | { |
629 | GNUNET_CLIENT_notify_transmit_ready_cancel (ph->th); | 631 | GNUNET_CLIENT_notify_transmit_ready_cancel (ph->th); |
diff --git a/src/ats/ats_api_scanner.c b/src/ats/ats_api_scanner.c index ce1c90567..64c02acf6 100644 --- a/src/ats/ats_api_scanner.c +++ b/src/ats/ats_api_scanner.c | |||
@@ -271,11 +271,12 @@ interface_proc (void *cls, | |||
271 | /* Store in list */ | 271 | /* Store in list */ |
272 | #if VERBOSE_ATS | 272 | #if VERBOSE_ATS |
273 | char * netmask = GNUNET_strdup (GNUNET_a2s((struct sockaddr *) net->netmask, addrlen)); | 273 | char * netmask = GNUNET_strdup (GNUNET_a2s((struct sockaddr *) net->netmask, addrlen)); |
274 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 274 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
275 | "Adding network `%s', netmask `%s'\n", | 275 | "ats-scanner-api", |
276 | GNUNET_a2s ((struct sockaddr *) net->network, | 276 | "Adding network `%s', netmask `%s'\n", |
277 | addrlen), | 277 | GNUNET_a2s ((struct sockaddr *) net->network, |
278 | netmask); | 278 | addrlen), |
279 | netmask); | ||
279 | GNUNET_free (netmask); | 280 | GNUNET_free (netmask); |
280 | #endif | 281 | #endif |
281 | GNUNET_CONTAINER_DLL_insert (is->net_head, | 282 | GNUNET_CONTAINER_DLL_insert (is->net_head, |
@@ -392,7 +393,7 @@ GNUNET_ATS_scanner_address_get_type (struct GNUNET_ATS_InterfaceScanner *is, | |||
392 | if (type == GNUNET_ATS_NET_UNSPECIFIED) | 393 | if (type == GNUNET_ATS_NET_UNSPECIFIED) |
393 | type = GNUNET_ATS_NET_WAN; | 394 | type = GNUNET_ATS_NET_WAN; |
394 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 395 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, |
395 | "ats-scheduling-api", | 396 | "ats-scanner-api", |
396 | "`%s' is in network `%s'\n", | 397 | "`%s' is in network `%s'\n", |
397 | GNUNET_a2s (addr, | 398 | GNUNET_a2s (addr, |
398 | addrlen), | 399 | addrlen), |
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index fb6df4494..e4db144d0 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c | |||
@@ -40,6 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | #define INTERFACE_PROCESSING_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2) | 41 | #define INTERFACE_PROCESSING_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2) |
42 | 42 | ||
43 | #define LOG(kind,...) GNUNET_log_from(kind, "ats-scheduling-api", __VA_ARGS__) | ||
43 | 44 | ||
44 | /** | 45 | /** |
45 | * Session ID we use if there is no session / slot. | 46 | * Session ID we use if there is no session / slot. |
@@ -417,11 +418,11 @@ process_ats_address_suggestion_message (void *cls, | |||
417 | if ( (0 == ntohl (m->bandwidth_out.value__)) && | 418 | if ( (0 == ntohl (m->bandwidth_out.value__)) && |
418 | (0 == ntohl (m->bandwidth_in.value__)) ) | 419 | (0 == ntohl (m->bandwidth_in.value__)) ) |
419 | { | 420 | { |
420 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 421 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
421 | "ATS suggests disconnect from peer `%s' with BW %u/%u\n", | 422 | "ATS suggests disconnect from peer `%s' with BW %u/%u\n", |
422 | GNUNET_i2s (&ar->address->peer), | 423 | GNUNET_i2s (&ar->address->peer), |
423 | (unsigned int) ntohl (m->bandwidth_out.value__), | 424 | (unsigned int) ntohl (m->bandwidth_out.value__), |
424 | (unsigned int) ntohl (m->bandwidth_in.value__)); | 425 | (unsigned int) ntohl (m->bandwidth_in.value__)); |
425 | sh->suggest_cb (sh->suggest_cb_cls, | 426 | sh->suggest_cb (sh->suggest_cb_cls, |
426 | &m->peer, | 427 | &m->peer, |
427 | NULL, | 428 | NULL, |
@@ -439,11 +440,11 @@ process_ats_address_suggestion_message (void *cls, | |||
439 | return; | 440 | return; |
440 | } | 441 | } |
441 | sh->backoff = GNUNET_TIME_UNIT_ZERO; | 442 | sh->backoff = GNUNET_TIME_UNIT_ZERO; |
442 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 443 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
443 | "ATS suggests address slot %u for peer `%s' using plugin %s\n", | 444 | "ATS suggests address slot %u for peer `%s' using plugin %s\n", |
444 | ar->slot, | 445 | ar->slot, |
445 | GNUNET_i2s (&ar->address->peer), | 446 | GNUNET_i2s (&ar->address->peer), |
446 | ar->address->transport_name); | 447 | ar->address->transport_name); |
447 | sh->suggest_cb (sh->suggest_cb_cls, | 448 | sh->suggest_cb (sh->suggest_cb_cls, |
448 | &m->peer, | 449 | &m->peer, |
449 | ar->address, | 450 | ar->address, |
@@ -466,9 +467,9 @@ error_handler (void *cls, | |||
466 | { | 467 | { |
467 | struct GNUNET_ATS_SchedulingHandle *sh = cls; | 468 | struct GNUNET_ATS_SchedulingHandle *sh = cls; |
468 | 469 | ||
469 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 470 | LOG (GNUNET_ERROR_TYPE_WARNING, |
470 | "ATS connection died (code %d), reconnecting\n", | 471 | "ATS connection died (code %d), reconnecting\n", |
471 | (int) error); | 472 | (int) error); |
472 | force_reconnect (sh); | 473 | force_reconnect (sh); |
473 | } | 474 | } |
474 | 475 | ||
@@ -507,12 +508,12 @@ send_add_address_message (struct GNUNET_ATS_SchedulingHandle *sh, | |||
507 | m->plugin_name_length = htons (namelen); | 508 | m->plugin_name_length = htons (namelen); |
508 | m->session_id = htonl (ar->slot); | 509 | m->session_id = htonl (ar->slot); |
509 | 510 | ||
510 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 511 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
511 | "Adding address for peer `%s', plugin `%s', session %p slot %u\n", | 512 | "Adding address for peer `%s', plugin `%s', session %p slot %u\n", |
512 | GNUNET_i2s (&ar->address->peer), | 513 | GNUNET_i2s (&ar->address->peer), |
513 | ar->address->transport_name, | 514 | ar->address->transport_name, |
514 | ar->session, | 515 | ar->session, |
515 | ar->slot); | 516 | ar->slot); |
516 | am = (struct GNUNET_ATS_Information *) &m[1]; | 517 | am = (struct GNUNET_ATS_Information *) &m[1]; |
517 | memcpy (am, | 518 | memcpy (am, |
518 | ar->ats, | 519 | ar->ats, |
@@ -706,7 +707,10 @@ GNUNET_ATS_address_add (struct GNUNET_ATS_SchedulingHandle *sh, | |||
706 | return NULL; | 707 | return NULL; |
707 | } | 708 | } |
708 | 709 | ||
709 | if (NOT_FOUND != find_session_id (sh, session, address)) | 710 | if (NOT_FOUND != |
711 | find_session_id (sh, | ||
712 | session, | ||
713 | address)) | ||
710 | { | 714 | { |
711 | /* Already existing, nothing todo, but this should not happen */ | 715 | /* Already existing, nothing todo, but this should not happen */ |
712 | GNUNET_break (0); | 716 | GNUNET_break (0); |
@@ -796,12 +800,12 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_AddressRecord *ar, | |||
796 | struct GNUNET_ATS_Information *am; | 800 | struct GNUNET_ATS_Information *am; |
797 | size_t msize; | 801 | size_t msize; |
798 | 802 | ||
799 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 803 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
800 | "Updating address for peer `%s', plugin `%s', session %p slot %u\n", | 804 | "Updating address for peer `%s', plugin `%s', session %p slot %u\n", |
801 | GNUNET_i2s (&ar->address->peer), | 805 | GNUNET_i2s (&ar->address->peer), |
802 | ar->address->transport_name, | 806 | ar->address->transport_name, |
803 | ar->session, | 807 | ar->session, |
804 | ar->slot); | 808 | ar->slot); |
805 | GNUNET_array_grow (ar->ats, | 809 | GNUNET_array_grow (ar->ats, |
806 | ar->ats_count, | 810 | ar->ats_count, |
807 | ats_count); | 811 | ats_count); |
@@ -837,12 +841,12 @@ GNUNET_ATS_address_destroy (struct GNUNET_ATS_AddressRecord *ar) | |||
837 | struct GNUNET_MQ_Envelope *ev; | 841 | struct GNUNET_MQ_Envelope *ev; |
838 | struct AddressDestroyedMessage *m; | 842 | struct AddressDestroyedMessage *m; |
839 | 843 | ||
840 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 844 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
841 | "Deleting address for peer `%s', plugin `%s', slot %u session %p\n", | 845 | "Deleting address for peer `%s', plugin `%s', slot %u session %p\n", |
842 | GNUNET_i2s (&ar->address->peer), | 846 | GNUNET_i2s (&ar->address->peer), |
843 | ar->address->transport_name, | 847 | ar->address->transport_name, |
844 | ar->slot, | 848 | ar->slot, |
845 | ar->session); | 849 | ar->session); |
846 | GNUNET_break (NULL == ar->session); | 850 | GNUNET_break (NULL == ar->session); |
847 | ar->session = NULL; | 851 | ar->session = NULL; |
848 | ar->in_destroy = GNUNET_YES; | 852 | ar->in_destroy = GNUNET_YES; |