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/ats_api_scheduling.c | |
parent | 98d966344028d236cc1296ec1fcedb8891774604 (diff) | |
download | gnunet-e649f10af79eb62bdd1eb0d358538779e3f49235.tar.gz gnunet-e649f10af79eb62bdd1eb0d358538779e3f49235.zip |
-fix
Diffstat (limited to 'src/ats/ats_api_scheduling.c')
-rw-r--r-- | src/ats/ats_api_scheduling.c | 68 |
1 files changed, 36 insertions, 32 deletions
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; |