aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_resolver_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2010-04-22 11:32:51 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2010-04-22 11:32:51 +0000
commit01d5ba6ff9dee277899783bc0217ceb87f2518ee (patch)
tree0744133fe04c36e544ec8b9ab4b9576ab2cb3ab5 /src/util/test_resolver_api.c
parent80f013beff06dc9457328b84411c56cf0445aeeb (diff)
downloadgnunet-01d5ba6ff9dee277899783bc0217ceb87f2518ee.tar.gz
gnunet-01d5ba6ff9dee277899783bc0217ceb87f2518ee.zip
Diffstat (limited to 'src/util/test_resolver_api.c')
-rw-r--r--src/util/test_resolver_api.c41
1 files changed, 2 insertions, 39 deletions
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c
index d0831bf49..daf676d01 100644
--- a/src/util/test_resolver_api.c
+++ b/src/util/test_resolver_api.c
@@ -139,7 +139,7 @@ check_local_fqdn(void *cls, const char *gnunet_fqdn)
139 { 139 {
140 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR | 140 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR |
141 GNUNET_ERROR_TYPE_BULK, "gethostname"); 141 GNUNET_ERROR_TYPE_BULK, "gethostname");
142 return NULL; 142 return;
143 } 143 }
144#if DEBUG_RESOLVER 144#if DEBUG_RESOLVER
145 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 145 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -151,7 +151,7 @@ check_local_fqdn(void *cls, const char *gnunet_fqdn)
151 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 151 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
152 _("Could not resolve our FQDN : %s %u\n"), 152 _("Could not resolve our FQDN : %s %u\n"),
153 hstrerror (h_errno), h_errno); 153 hstrerror (h_errno), h_errno);
154 return NULL; 154 return;
155 } 155 }
156 156
157 GNUNET_assert( 0 != host); 157 GNUNET_assert( 0 != host);
@@ -165,36 +165,6 @@ check_local_fqdn(void *cls, const char *gnunet_fqdn)
165 GNUNET_assert( 0 == result); 165 GNUNET_assert( 0 == result);
166} 166}
167 167
168static void
169check_local_hostname(void *cls, const char *hostname)
170{
171 int result = 0;
172
173 char own_hostname[GNUNET_OS_get_hostname_max_length() + 1];
174#if DEBUG_RESOLVER
175 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
176 "Hostname resolved here is `%s'.\n", own_hostname);
177 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
178 "Hostname resolved using resolver is `%s'.\n", hostname);
179#endif
180
181 result = gethostname (own_hostname, sizeof (own_hostname) - 1);
182
183 if ( 0 != result )
184 {
185 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
186 "Could not resolve local hostname\n", own_hostname);
187 }
188 GNUNET_assert( 0 == result);
189
190 result = strcmp(hostname, own_hostname);
191 if ( 0 != result )
192 {
193 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
194 "Local resolved and resolver resolved hostnames are not equal\n", own_hostname);
195 }
196 GNUNET_assert( 0 == result);
197}
198 168
199 169
200static void 170static void
@@ -256,7 +226,6 @@ run(void *cls, struct GNUNET_SCHEDULER_Handle *sched, char * const *args,
256 struct GNUNET_TIME_Relative timeout = GNUNET_TIME_relative_multiply( 226 struct GNUNET_TIME_Relative timeout = GNUNET_TIME_relative_multiply(
257 GNUNET_TIME_UNIT_MILLISECONDS, 2500); 227 GNUNET_TIME_UNIT_MILLISECONDS, 2500);
258 int count_ips = 0; 228 int count_ips = 0;
259 char * own_hostname;
260 char * own_fqdn; 229 char * own_fqdn;
261 230
262 memset(&sa, 0, sizeof(sa)); 231 memset(&sa, 0, sizeof(sa));
@@ -271,12 +240,6 @@ run(void *cls, struct GNUNET_SCHEDULER_Handle *sched, char * const *args,
271 GNUNET_RESOLVER_hostname_resolve(sched, cfg, AF_UNSPEC, timeout, 240 GNUNET_RESOLVER_hostname_resolve(sched, cfg, AF_UNSPEC, timeout,
272 &check_hostname, cls); 241 &check_hostname, cls);
273 242
274 /*
275 * Looking up our own hostname
276 */
277 own_hostname = GNUNET_RESOLVER_local_hostname_get();
278 check_local_hostname( NULL, own_hostname);
279 GNUNET_free (own_hostname);
280 243
281 /* 244 /*
282 * Looking up our own fqdn 245 * Looking up our own fqdn