-connect_to_service_dns (void *cls __attribute__((unused)),
- const struct GNUNET_SCHEDULER_TaskContext *tc) {
- if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
- return;
- GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting to service-dns\n");
- GNUNET_assert (dns_connection == NULL);
- dns_connection = GNUNET_CLIENT_connect ("dns", cfg);
- /* This would most likely be a misconfiguration */
- GNUNET_assert(NULL != dns_connection);
- GNUNET_CLIENT_receive(dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL);
-
- /* We might not yet be connected. Yay, mps. */
- if (NULL == dns_connection) return;
-
- /* If a packet is already in the list, schedule to send it */
- if (head != NULL)
- GNUNET_CLIENT_notify_transmit_ready(dns_connection,
- ntohs(head->pkt.hdr.size),
- GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_YES,
- &send_query,
- NULL);
- else if (restart_hijack == 1)
- {
- GNUNET_CLIENT_notify_transmit_ready(dns_connection, sizeof(struct GNUNET_MessageHeader), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &send_query, NULL);
- }
+connect_to_service_dns (void *cls
+ __attribute__ ((unused)),
+ const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ conn_task = GNUNET_SCHEDULER_NO_TASK;
+ if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
+ return;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to service-dns\n");
+ GNUNET_assert (dns_connection == NULL);
+ dns_connection = GNUNET_CLIENT_connect ("dns", cfg);
+ /* This would most likely be a misconfiguration */
+ GNUNET_assert (NULL != dns_connection);
+ GNUNET_CLIENT_receive (dns_connection, &dns_answer_handler, NULL,
+ GNUNET_TIME_UNIT_FOREVER_REL);
+
+ /* We might not yet be connected. Yay, mps. */
+ if (NULL == dns_connection)
+ return;
+
+ /* If a packet is already in the list, schedule to send it */
+ if (dns_transmit_handle == NULL && head != NULL)
+ dns_transmit_handle =
+ GNUNET_CLIENT_notify_transmit_ready (dns_connection,
+ ntohs (head->pkt.hdr.size),
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_YES, &send_query, NULL);
+ else if (dns_transmit_handle == NULL && restart_hijack == 1)
+ {
+ dns_transmit_handle =
+ GNUNET_CLIENT_notify_transmit_ready (dns_connection,
+ sizeof (struct
+ GNUNET_MessageHeader),
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ GNUNET_YES, &send_query, NULL);
+ }