aboutsummaryrefslogtreecommitdiff
path: root/src/util/resolver_api.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-07-14 11:28:36 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-07-14 11:28:36 +0000
commit8af646076372f322fd772736523e890cef2d69f0 (patch)
tree26c9073664628d4d549ae56fb564fd62b423e8a3 /src/util/resolver_api.c
parent4db7c5604fe7fa1609dea044b0c3850d15c02138 (diff)
downloadgnunet-8af646076372f322fd772736523e890cef2d69f0.tar.gz
gnunet-8af646076372f322fd772736523e890cef2d69f0.zip
some docu
Diffstat (limited to 'src/util/resolver_api.c')
-rw-r--r--src/util/resolver_api.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index 7d59f673a..3ff005263 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -139,6 +139,9 @@ struct GNUNET_RESOLVER_RequestHandle
139 139
140 /** 140 /**
141 * Has this request been transmitted to the service? 141 * Has this request been transmitted to the service?
142 * GNUNET_YES if transmitted
143 * GNUNET_YES if not transmitted
144 * GNUNET_SYSERR when request was canceled
142 */ 145 */
143 int was_transmitted; 146 int was_transmitted;
144 147
@@ -363,13 +366,16 @@ handle_response (void *cls,
363 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 366 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
364 _("Timeout trying to resolve hostname `%s'.\n"), 367 _("Timeout trying to resolve hostname `%s'.\n"),
365 (const char *) &rh[1]); 368 (const char *) &rh[1]);
369 /* check if request was canceled */
366 if (rh->was_transmitted != GNUNET_SYSERR) 370 if (rh->was_transmitted != GNUNET_SYSERR)
367 { 371 {
368 if (NULL != rh->name_callback) 372 if (NULL != rh->name_callback)
369 { 373 {
374 /* no reverse lookup was successful, return ip as string */
370 if (rh->received_response == GNUNET_NO) 375 if (rh->received_response == GNUNET_NO)
371 rh->name_callback (rh->cls, 376 rh->name_callback (rh->cls,
372 no_resolve ((const struct sockaddr *) &rh[1], rh->data_len)); 377 no_resolve ((const struct sockaddr *) &rh[1], rh->data_len));
378 /* at least one reverse lookup was successful */
373 else 379 else
374 rh->name_callback (rh->cls, NULL); 380 rh->name_callback (rh->cls, NULL);
375 } 381 }
@@ -394,8 +400,10 @@ handle_response (void *cls,
394 return; 400 return;
395 } 401 }
396 size = ntohs (msg->size); 402 size = ntohs (msg->size);
403 /* message contains not data, just header */
397 if (size == sizeof (struct GNUNET_MessageHeader)) 404 if (size == sizeof (struct GNUNET_MessageHeader))
398 { 405 {
406 /* check if request was canceled */
399 if (rh->was_transmitted != GNUNET_SYSERR) 407 if (rh->was_transmitted != GNUNET_SYSERR)
400 { 408 {
401 if (NULL != rh->name_callback) 409 if (NULL != rh->name_callback)
@@ -410,6 +418,7 @@ handle_response (void *cls,
410 process_requests (); 418 process_requests ();
411 return; 419 return;
412 } 420 }
421 /* return reverse lookup results to caller */
413 if (NULL != rh->name_callback) 422 if (NULL != rh->name_callback)
414 { 423 {
415 hostname = (const char *) &msg[1]; 424 hostname = (const char *) &msg[1];
@@ -441,6 +450,7 @@ handle_response (void *cls,
441 rh, 450 rh,
442 GNUNET_TIME_absolute_get_remaining (rh->timeout)); 451 GNUNET_TIME_absolute_get_remaining (rh->timeout));
443 } 452 }
453 /* return lookup results to caller */
444 if (NULL != rh->addr_callback) 454 if (NULL != rh->addr_callback)
445 { 455 {
446 sa = (const struct sockaddr *) &msg[1]; 456 sa = (const struct sockaddr *) &msg[1];
@@ -834,6 +844,7 @@ numeric_reverse (void *cls,
834 * @param do_resolve use GNUNET_NO to return numeric hostname 844 * @param do_resolve use GNUNET_NO to return numeric hostname
835 * @param timeout how long to try resolving 845 * @param timeout how long to try resolving
836 * @param callback function to call with hostnames 846 * @param callback function to call with hostnames
847 * last callback is NULL when finished
837 * @param cls closure for callback 848 * @param cls closure for callback
838 * @return handle that can be used to cancel the request 849 * @return handle that can be used to cancel the request
839 */ 850 */