aboutsummaryrefslogtreecommitdiff
path: root/src/hostlist/gnunet-daemon-hostlist_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hostlist/gnunet-daemon-hostlist_server.c')
-rw-r--r--src/hostlist/gnunet-daemon-hostlist_server.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/hostlist/gnunet-daemon-hostlist_server.c b/src/hostlist/gnunet-daemon-hostlist_server.c
index 6e2cb7ee4..5b45af831 100644
--- a/src/hostlist/gnunet-daemon-hostlist_server.c
+++ b/src/hostlist/gnunet-daemon-hostlist_server.c
@@ -74,12 +74,12 @@ static struct GNUNET_PEERINFO_NotifyContext *notify;
74/** 74/**
75 * Our primary task for IPv4. 75 * Our primary task for IPv4.
76 */ 76 */
77static struct GNUNET_SCHEDULER_Task * hostlist_task_v4; 77static struct GNUNET_SCHEDULER_Task *hostlist_task_v4;
78 78
79/** 79/**
80 * Our primary task for IPv6. 80 * Our primary task for IPv6.
81 */ 81 */
82static struct GNUNET_SCHEDULER_Task * hostlist_task_v6; 82static struct GNUNET_SCHEDULER_Task *hostlist_task_v6;
83 83
84/** 84/**
85 * Our canonical response. 85 * Our canonical response.
@@ -632,15 +632,11 @@ static void
632run_daemon (void *cls) 632run_daemon (void *cls)
633{ 633{
634 struct MHD_Daemon *daemon_handle = cls; 634 struct MHD_Daemon *daemon_handle = cls;
635 const struct GNUNET_SCHEDULER_TaskContext *tc;
636 635
637 if (daemon_handle == daemon_handle_v4) 636 if (daemon_handle == daemon_handle_v4)
638 hostlist_task_v4 = NULL; 637 hostlist_task_v4 = NULL;
639 else 638 else
640 hostlist_task_v6 = NULL; 639 hostlist_task_v6 = NULL;
641 tc = GNUNET_SCHEDULER_get_task_context ();
642 if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
643 return;
644 GNUNET_assert (MHD_YES == MHD_run (daemon_handle)); 640 GNUNET_assert (MHD_YES == MHD_run (daemon_handle));
645 if (daemon_handle == daemon_handle_v4) 641 if (daemon_handle == daemon_handle_v4)
646 hostlist_task_v4 = prepare_daemon (daemon_handle); 642 hostlist_task_v4 = prepare_daemon (daemon_handle);
@@ -675,7 +671,9 @@ prepare_daemon (struct MHD_Daemon *daemon_handle)
675 wrs = GNUNET_NETWORK_fdset_create (); 671 wrs = GNUNET_NETWORK_fdset_create ();
676 wws = GNUNET_NETWORK_fdset_create (); 672 wws = GNUNET_NETWORK_fdset_create ();
677 max = -1; 673 max = -1;
678 GNUNET_assert (MHD_YES == MHD_get_fdset (daemon_handle, &rs, &ws, &es, &max)); 674 GNUNET_assert (MHD_YES ==
675 MHD_get_fdset (daemon_handle,
676 &rs, &ws, &es, &max));
679 haveto = MHD_get_timeout (daemon_handle, &timeout); 677 haveto = MHD_get_timeout (daemon_handle, &timeout);
680 if (haveto == MHD_YES) 678 if (haveto == MHD_YES)
681 tv.rel_value_us = (uint64_t) timeout * 1000LL; 679 tv.rel_value_us = (uint64_t) timeout * 1000LL;
@@ -683,10 +681,9 @@ prepare_daemon (struct MHD_Daemon *daemon_handle)
683 tv = GNUNET_TIME_UNIT_FOREVER_REL; 681 tv = GNUNET_TIME_UNIT_FOREVER_REL;
684 GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1); 682 GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1);
685 GNUNET_NETWORK_fdset_copy_native (wws, &ws, max + 1); 683 GNUNET_NETWORK_fdset_copy_native (wws, &ws, max + 1);
686 ret = 684 ret = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
687 GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, 685 tv, wrs, wws,
688 tv, wrs, wws, 686 &run_daemon, daemon_handle);
689 &run_daemon, daemon_handle);
690 GNUNET_NETWORK_fdset_destroy (wrs); 687 GNUNET_NETWORK_fdset_destroy (wrs);
691 GNUNET_NETWORK_fdset_destroy (wws); 688 GNUNET_NETWORK_fdset_destroy (wws);
692 return ret; 689 return ret;