diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-17 21:31:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-17 21:31:48 +0000 |
commit | c76f29f898f6b1a73f33ce6d2578e06ce8e0a24e (patch) | |
tree | 4d9fbf87fa9d65b8b966b51739af96205943be8f /src/ats/gnunet-service-ats_addresses.c | |
parent | f6323d915af7494ecfeba39407d1c30dc06dc238 (diff) | |
download | gnunet-c76f29f898f6b1a73f33ce6d2578e06ce8e0a24e.tar.gz gnunet-c76f29f898f6b1a73f33ce6d2578e06ce8e0a24e.zip |
use ATS functions to convert quality network type to string, instead of using string API
Diffstat (limited to 'src/ats/gnunet-service-ats_addresses.c')
-rw-r--r-- | src/ats/gnunet-service-ats_addresses.c | 47 |
1 files changed, 30 insertions, 17 deletions
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c index f0af8f1a2..89158936d 100644 --- a/src/ats/gnunet-service-ats_addresses.c +++ b/src/ats/gnunet-service-ats_addresses.c | |||
@@ -1746,7 +1746,6 @@ static unsigned int | |||
1746 | load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | 1746 | load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1747 | unsigned long long *out_dest, unsigned long long *in_dest, int dest_length) | 1747 | unsigned long long *out_dest, unsigned long long *in_dest, int dest_length) |
1748 | { | 1748 | { |
1749 | char *network_str[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString; | ||
1750 | char * entry_in = NULL; | 1749 | char * entry_in = NULL; |
1751 | char * entry_out = NULL; | 1750 | char * entry_out = NULL; |
1752 | char * quota_out_str; | 1751 | char * quota_out_str; |
@@ -1758,8 +1757,12 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1758 | { | 1757 | { |
1759 | in_dest[c] = 0; | 1758 | in_dest[c] = 0; |
1760 | out_dest[c] = 0; | 1759 | out_dest[c] = 0; |
1761 | GNUNET_asprintf (&entry_out, "%s_QUOTA_OUT", network_str[c]); | 1760 | GNUNET_asprintf (&entry_out, |
1762 | GNUNET_asprintf (&entry_in, "%s_QUOTA_IN", network_str[c]); | 1761 | "%s_QUOTA_OUT", |
1762 | GNUNET_ATS_print_network_type (c)); | ||
1763 | GNUNET_asprintf (&entry_in, | ||
1764 | "%s_QUOTA_IN", | ||
1765 | GNUNET_ATS_print_network_type (c)); | ||
1763 | 1766 | ||
1764 | /* quota out */ | 1767 | /* quota out */ |
1765 | if (GNUNET_OK | 1768 | if (GNUNET_OK |
@@ -1786,23 +1789,27 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1786 | if (GNUNET_NO == res) | 1789 | if (GNUNET_NO == res) |
1787 | { | 1790 | { |
1788 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1791 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1789 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), | 1792 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), |
1790 | network_str[c], quota_out_str, GNUNET_ATS_DefaultBandwidth); | 1793 | GNUNET_ATS_print_network_type (c), |
1794 | quota_out_str, | ||
1795 | GNUNET_ATS_DefaultBandwidth); | ||
1791 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 1796 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
1792 | } | 1797 | } |
1793 | else | 1798 | else |
1794 | { | 1799 | { |
1795 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 1800 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
1796 | _("Outbound quota configure for network `%s' is %llu\n"), | 1801 | _("Outbound quota configure for network `%s' is %llu\n"), |
1797 | network_str[c], out_dest[c]); | 1802 | GNUNET_ATS_print_network_type (c), |
1803 | out_dest[c]); | ||
1798 | } | 1804 | } |
1799 | GNUNET_free(quota_out_str); | 1805 | GNUNET_free(quota_out_str); |
1800 | } | 1806 | } |
1801 | else | 1807 | else |
1802 | { | 1808 | { |
1803 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1809 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1804 | _("No outbound quota configured for network `%s', assigning default bandwidth %llu\n"), | 1810 | _("No outbound quota configured for network `%s', assigning default bandwidth %llu\n"), |
1805 | network_str[c], GNUNET_ATS_DefaultBandwidth); | 1811 | GNUNET_ATS_print_network_type (c), |
1812 | GNUNET_ATS_DefaultBandwidth); | ||
1806 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; | 1813 | out_dest[c] = GNUNET_ATS_DefaultBandwidth; |
1807 | } | 1814 | } |
1808 | 1815 | ||
@@ -1830,28 +1837,34 @@ load_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1830 | if (GNUNET_NO == res) | 1837 | if (GNUNET_NO == res) |
1831 | { | 1838 | { |
1832 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1839 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1833 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), | 1840 | _("Could not load quota for network `%s': `%s', assigning default bandwidth %llu\n"), |
1834 | network_str[c], quota_in_str, GNUNET_ATS_DefaultBandwidth); | 1841 | GNUNET_ATS_print_network_type (c), |
1842 | quota_in_str, | ||
1843 | GNUNET_ATS_DefaultBandwidth); | ||
1835 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; | 1844 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; |
1836 | } | 1845 | } |
1837 | else | 1846 | else |
1838 | { | 1847 | { |
1839 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | 1848 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, |
1840 | _("Inbound quota configured for network `%s' is %llu\n"), | 1849 | _("Inbound quota configured for network `%s' is %llu\n"), |
1841 | network_str[c], in_dest[c]); | 1850 | GNUNET_ATS_print_network_type (c), |
1851 | in_dest[c]); | ||
1842 | } | 1852 | } |
1843 | GNUNET_free(quota_in_str); | 1853 | GNUNET_free(quota_in_str); |
1844 | } | 1854 | } |
1845 | else | 1855 | else |
1846 | { | 1856 | { |
1847 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 1857 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
1848 | _("No outbound quota configure for network `%s', assigning default bandwidth %llu\n"), | 1858 | _("No outbound quota configure for network `%s', assigning default bandwidth %llu\n"), |
1849 | network_str[c], GNUNET_ATS_DefaultBandwidth); | 1859 | GNUNET_ATS_print_network_type (c), |
1860 | GNUNET_ATS_DefaultBandwidth); | ||
1850 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; | 1861 | in_dest[c] = GNUNET_ATS_DefaultBandwidth; |
1851 | } | 1862 | } |
1852 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1863 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1853 | "Loaded quota for network `%s' (in/out): %llu %llu\n", network_str[c], | 1864 | "Loaded quota for network `%s' (in/out): %llu %llu\n", |
1854 | in_dest[c], out_dest[c]); | 1865 | GNUNET_ATS_print_network_type (c), |
1866 | in_dest[c], | ||
1867 | out_dest[c]); | ||
1855 | GNUNET_free(entry_out); | 1868 | GNUNET_free(entry_out); |
1856 | GNUNET_free(entry_in); | 1869 | GNUNET_free(entry_in); |
1857 | } | 1870 | } |