- {
- result = no_resolve (sa, salen);
-#if DEBUG_RESOLVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- _("Resolver returns `%s'.\n"), result);
-#endif
- callback (cls, result);
- if (result != NULL)
- {
- GNUNET_free (result);
- callback (cls, NULL);
- }
- return;
- }
- if (salen + sizeof (struct GNUNET_RESOLVER_GetMessage) >
- GNUNET_SERVER_MAX_MESSAGE_SIZE)
- {
- GNUNET_break (0);
- callback (cls, NULL);
- return;
- }
- client = GNUNET_CLIENT_connect (sched, "resolver", cfg);
- if (client == NULL)
- {
- callback (cls, NULL);
- return;
- }
- msg = GNUNET_malloc (sizeof (struct GNUNET_RESOLVER_GetMessage) + salen);
- msg->header.size =
- htons (sizeof (struct GNUNET_RESOLVER_GetMessage) + salen);
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST);
- msg->direction = htonl (GNUNET_YES);
- msg->domain = htonl (sa->sa_family);
- memcpy (&msg[1], sa, salen);
-#if DEBUG_RESOLVER
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- _("Resolver requests DNS resolution of IP address.\n"));
-#endif
- hctx = GNUNET_malloc (sizeof (struct GetHostnameContext));
- hctx->callback = callback;
- hctx->cls = cls;
- hctx->client = client;
- hctx->timeout = GNUNET_TIME_relative_to_absolute (timeout);
- hctx->msg = msg;
- if (NULL ==
- GNUNET_CLIENT_notify_transmit_ready (client,
- sizeof (struct
- GNUNET_RESOLVER_GetMessage)
- + salen, timeout,
- &transmit_get_hostname, hctx))
- {
- GNUNET_free (msg);
- callback (cls, NULL);
- GNUNET_CLIENT_disconnect (client);
- GNUNET_free (hctx);
- }
+ {
+ rh->task = GNUNET_SCHEDULER_add_now (&numeric_reverse, rh);
+ return rh;
+ }
+ GNUNET_CONTAINER_DLL_insert_tail (req_head, req_tail, rh);
+ rh->was_queued = GNUNET_YES;
+ if (s_task != GNUNET_SCHEDULER_NO_TASK)
+ {
+ GNUNET_SCHEDULER_cancel (s_task);
+ s_task = GNUNET_SCHEDULER_NO_TASK;
+ }
+ process_requests ();
+ return rh;