diff options
author | wachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-12-12 09:20:00 +0000 |
---|---|---|
committer | wachs <wachs@140774ce-b5e7-0310-ab8b-a85725594a96> | 2012-12-12 09:20:00 +0000 |
commit | 4860428800f6aba9443c79836aad6765339321ea (patch) | |
tree | 48f7b4976f6b4d5488e6e31f4863112f524e55b1 /src/ats | |
parent | ae63b77ee59f05156ae5a937de74c7be09654afa (diff) |
msgs
git-svn-id: https://gnunet.org/svn/gnunet@25405 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/ats_api_scheduling.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c index 1787c94cf1..077359d6b3 100644 --- a/src/ats/ats_api_scheduling.c +++ b/src/ats/ats_api_scheduling.c @@ -822,6 +822,7 @@ GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle * sh, const stru { GNUNET_assert (sh != NULL); struct ATS_Network * cur = sh->net_head; + char *networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkTypeString; int type = GNUNET_ATS_NET_UNSPECIFIED; struct GNUNET_ATS_Information ats; @@ -862,15 +863,7 @@ GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle * sh, const stru struct sockaddr_in * mask4 = (struct sockaddr_in *) cur->netmask; if (((a4->sin_addr.s_addr & mask4->sin_addr.s_addr)) == net4->sin_addr.s_addr) - { - char * net = GNUNET_strdup (GNUNET_a2s ((const struct sockaddr *) net4, addrlen)); - GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "ats-scheduling-api", - "`%s' is in network `%s'\n", - GNUNET_a2s ((const struct sockaddr *)a4, addrlen), - net); - GNUNET_free (net); type = GNUNET_ATS_NET_LAN; - } } if (addr->sa_family == AF_INET6) { @@ -888,14 +881,7 @@ GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle * sh, const stru res = GNUNET_NO; if (res == GNUNET_YES) - { - char * net = GNUNET_strdup (GNUNET_a2s ((const struct sockaddr *) net6, addrlen)); - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "`%s' is in network `%s'\n", - GNUNET_a2s ((const struct sockaddr *) a6, addrlen), - net); - GNUNET_free (net); type = GNUNET_ATS_NET_LAN; - } } cur = cur->next; } @@ -904,7 +890,13 @@ GNUNET_ATS_address_get_type (struct GNUNET_ATS_SchedulingHandle * sh, const stru if (type == GNUNET_ATS_NET_UNSPECIFIED) type = GNUNET_ATS_NET_WAN; ats.type = htonl (GNUNET_ATS_NETWORK_TYPE); - ats.value = htonl (type); + ats.value = htonl (type); + + GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "ats-scheduling-api", + "`%s' is in network `%s'\n", + GNUNET_a2s ((const struct sockaddr *) addr, addrlen), + networks[type]); + return ats; } |