aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-05-27 09:09:45 +0000
committerChristian Grothoff <christian@grothoff.org>2014-05-27 09:09:45 +0000
commitf73ef0a224749c6cda11a01506fcdb47531f9206 (patch)
treed77732d580a173320bd988f7014a96b91696a137 /src/ats
parent37718ec50cbf69d7338797ab9dadb0b8e7f96ddb (diff)
downloadgnunet-f73ef0a224749c6cda11a01506fcdb47531f9206.tar.gz
gnunet-f73ef0a224749c6cda11a01506fcdb47531f9206.zip
-indentation fixes
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/plugin_ats_proportional.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c
index 8206d19c4..6414e99ef 100644
--- a/src/ats/plugin_ats_proportional.c
+++ b/src/ats/plugin_ats_proportional.c
@@ -735,35 +735,38 @@ struct FindBestAddressCtx
735 struct ATS_Address *best; 735 struct ATS_Address *best;
736}; 736};
737 737
738
738static int 739static int
739find_property_index (uint32_t type) 740find_property_index (uint32_t type)
740{ 741{
741 int existing_types[] = GNUNET_ATS_QualityProperties; 742 int existing_types[] = GNUNET_ATS_QualityProperties;
742 int c; 743 int c;
744
743 for (c = 0; c < GNUNET_ATS_QualityPropertiesCount; c++) 745 for (c = 0; c < GNUNET_ATS_QualityPropertiesCount; c++)
744 if (existing_types[c] == type) 746 if (existing_types[c] == type)
745 return c; 747 return c;
746 return GNUNET_SYSERR; 748 return GNUNET_SYSERR;
747} 749}
748 750
751
749/** 752/**
750 * Find a "good" address to use for a peer by iterating over the addresses for this peer. 753 * Find a "good" address to use for a peer by iterating over the addresses for this peer.
751 * If we already have an existing address, we stick to it. 754 * If we already have an existing address, we stick to it.
752 * Otherwise, we pick by lowest distance and then by lowest latency. 755 * Otherwise, we pick by lowest distance and then by lowest latency.
753 * 756 *
754 * @param cls the 'struct ATS_Address**' where we store the result 757 * @param cls the `struct FindBestAddressCtx *' where we store the result
755 * @param key unused 758 * @param key unused
756 * @param value another 'struct ATS_Address*' to consider using 759 * @param value another `struct ATS_Address*` to consider using
757 * @return GNUNET_OK (continue to iterate) 760 * @return #GNUNET_OK (continue to iterate)
758 */ 761 */
759static int 762static int
760find_best_address_it (void *cls, 763find_best_address_it (void *cls,
761 const struct GNUNET_PeerIdentity *key, 764 const struct GNUNET_PeerIdentity *key,
762 void *value) 765 void *value)
763{ 766{
764 struct FindBestAddressCtx *ctx = (struct FindBestAddressCtx *) cls; 767 struct FindBestAddressCtx *ctx = cls;
765 struct ATS_Address *current = (struct ATS_Address *) value; 768 struct ATS_Address *current = value;
766 struct ATS_Address *current_best = (struct ATS_Address *) value; 769 struct ATS_Address *current_best = current;
767 struct GNUNET_TIME_Absolute now; 770 struct GNUNET_TIME_Absolute now;
768 struct AddressSolverInformation *asi; 771 struct AddressSolverInformation *asi;
769 struct GNUNET_TIME_Relative active_time; 772 struct GNUNET_TIME_Relative active_time;
@@ -785,9 +788,11 @@ find_best_address_it (void *cls,
785 == GNUNET_TIME_absolute_max (now, current->blocked_until).abs_value_us)) 788 == GNUNET_TIME_absolute_max (now, current->blocked_until).abs_value_us))
786 { 789 {
787 /* This address is blocked for suggestion */ 790 /* This address is blocked for suggestion */
788 LOG(GNUNET_ERROR_TYPE_DEBUG, "Address %p blocked for suggestion for %s \n", 791 LOG (GNUNET_ERROR_TYPE_DEBUG,
789 current, 792 "Address %p blocked for suggestion for %s \n",
790 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (now, current->blocked_until), GNUNET_YES)); 793 current,
794 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_difference (now, current->blocked_until),
795 GNUNET_YES));
791 return GNUNET_OK; 796 return GNUNET_OK;
792 } 797 }
793 if (NULL == asi) 798 if (NULL == asi)
@@ -809,7 +814,9 @@ find_best_address_it (void *cls,
809 else 814 else
810 { 815 {
811 /* We do not have a 'best' address so take this address */ 816 /* We do not have a 'best' address so take this address */
812 LOG (GNUNET_ERROR_TYPE_DEBUG, "Setting initial address %p\n", current); 817 LOG (GNUNET_ERROR_TYPE_DEBUG,
818 "Setting initial address %p\n",
819 current);
813 current_best = current; 820 current_best = current;
814 goto end; 821 goto end;
815 } 822 }