diff options
-rw-r--r-- | src/vpn/gnunet-daemon-vpn-dns.c | 12 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn-dns.h | 2 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn-helper.c | 1 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn-helper.h | 2 | ||||
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.c | 18 |
5 files changed, 28 insertions, 7 deletions
diff --git a/src/vpn/gnunet-daemon-vpn-dns.c b/src/vpn/gnunet-daemon-vpn-dns.c index 46ec6d659..bb27c1401 100644 --- a/src/vpn/gnunet-daemon-vpn-dns.c +++ b/src/vpn/gnunet-daemon-vpn-dns.c | |||
@@ -111,6 +111,7 @@ send_query(void* cls __attribute__((unused)), size_t size, void* buf) { | |||
111 | void | 111 | void |
112 | connect_to_service_dns (void *cls __attribute__((unused)), | 112 | connect_to_service_dns (void *cls __attribute__((unused)), |
113 | const struct GNUNET_SCHEDULER_TaskContext *tc) { | 113 | const struct GNUNET_SCHEDULER_TaskContext *tc) { |
114 | conn_task = GNUNET_SCHEDULER_NO_TASK; | ||
114 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 115 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
115 | return; | 116 | return; |
116 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting to service-dns\n"); | 117 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting to service-dns\n"); |
@@ -135,6 +136,7 @@ connect_to_service_dns (void *cls __attribute__((unused)), | |||
135 | { | 136 | { |
136 | GNUNET_CLIENT_notify_transmit_ready(dns_connection, sizeof(struct GNUNET_MessageHeader), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &send_query, NULL); | 137 | GNUNET_CLIENT_notify_transmit_ready(dns_connection, sizeof(struct GNUNET_MessageHeader), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &send_query, NULL); |
137 | } | 138 | } |
139 | conn_task = GNUNET_SCHEDULER_add_now (start_helper_and_schedule, NULL); | ||
138 | } | 140 | } |
139 | 141 | ||
140 | /** | 142 | /** |
@@ -148,9 +150,9 @@ dns_answer_handler(void* cls __attribute__((unused)), const struct GNUNET_Messag | |||
148 | { | 150 | { |
149 | GNUNET_CLIENT_disconnect(dns_connection, GNUNET_NO); | 151 | GNUNET_CLIENT_disconnect(dns_connection, GNUNET_NO); |
150 | dns_connection = NULL; | 152 | dns_connection = NULL; |
151 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 153 | conn_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
152 | &connect_to_service_dns, | 154 | &connect_to_service_dns, |
153 | NULL); | 155 | NULL); |
154 | return; | 156 | return; |
155 | } | 157 | } |
156 | 158 | ||
@@ -160,8 +162,8 @@ dns_answer_handler(void* cls __attribute__((unused)), const struct GNUNET_Messag | |||
160 | GNUNET_break (0); | 162 | GNUNET_break (0); |
161 | GNUNET_CLIENT_disconnect(dns_connection, GNUNET_NO); | 163 | GNUNET_CLIENT_disconnect(dns_connection, GNUNET_NO); |
162 | dns_connection = NULL; | 164 | dns_connection = NULL; |
163 | GNUNET_SCHEDULER_add_now (&connect_to_service_dns, | 165 | conn_task = GNUNET_SCHEDULER_add_now (&connect_to_service_dns, |
164 | NULL); | 166 | NULL); |
165 | return; | 167 | return; |
166 | } | 168 | } |
167 | void *pkt = GNUNET_malloc(ntohs(msg->size)); | 169 | void *pkt = GNUNET_malloc(ntohs(msg->size)); |
diff --git a/src/vpn/gnunet-daemon-vpn-dns.h b/src/vpn/gnunet-daemon-vpn-dns.h index d27599e48..ed980e65f 100644 --- a/src/vpn/gnunet-daemon-vpn-dns.h +++ b/src/vpn/gnunet-daemon-vpn-dns.h | |||
@@ -80,4 +80,6 @@ extern struct answer_packet_list *answer_proc_head; | |||
80 | */ | 80 | */ |
81 | extern struct answer_packet_list *answer_proc_tail; | 81 | extern struct answer_packet_list *answer_proc_tail; |
82 | 82 | ||
83 | extern GNUNET_SCHEDULER_TaskIdentifier conn_task; | ||
84 | |||
83 | #endif /* end of include guard: GNUNET-DAEMON-VPN-DNS_H */ | 85 | #endif /* end of include guard: GNUNET-DAEMON-VPN-DNS_H */ |
diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c index 8c27378e0..9a1ddd8cc 100644 --- a/src/vpn/gnunet-daemon-vpn-helper.c +++ b/src/vpn/gnunet-daemon-vpn-helper.c | |||
@@ -55,6 +55,7 @@ struct GNUNET_VPN_HELPER_Handle *helper_handle; | |||
55 | void | 55 | void |
56 | start_helper_and_schedule(void *cls, | 56 | start_helper_and_schedule(void *cls, |
57 | const struct GNUNET_SCHEDULER_TaskContext *tc) { | 57 | const struct GNUNET_SCHEDULER_TaskContext *tc) { |
58 | shs_task = GNUNET_SCHEDULER_NO_TASK; | ||
58 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 59 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
59 | return; | 60 | return; |
60 | 61 | ||
diff --git a/src/vpn/gnunet-daemon-vpn-helper.h b/src/vpn/gnunet-daemon-vpn-helper.h index 093343742..85436e2cd 100644 --- a/src/vpn/gnunet-daemon-vpn-helper.h +++ b/src/vpn/gnunet-daemon-vpn-helper.h | |||
@@ -33,6 +33,8 @@ | |||
33 | */ | 33 | */ |
34 | extern struct GNUNET_VPN_HELPER_Handle *helper_handle; | 34 | extern struct GNUNET_VPN_HELPER_Handle *helper_handle; |
35 | 35 | ||
36 | extern GNUNET_SCHEDULER_TaskIdentifier shs_task; | ||
37 | |||
36 | /** | 38 | /** |
37 | * Start the helper-process | 39 | * Start the helper-process |
38 | */ | 40 | */ |
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index 9a1f69c72..cef876b52 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c | |||
@@ -61,6 +61,10 @@ static int ret; | |||
61 | */ | 61 | */ |
62 | static struct GNUNET_CONTAINER_MultiHashMap *udp_connections; | 62 | static struct GNUNET_CONTAINER_MultiHashMap *udp_connections; |
63 | 63 | ||
64 | GNUNET_SCHEDULER_TaskIdentifier conn_task; | ||
65 | |||
66 | GNUNET_SCHEDULER_TaskIdentifier shs_task; | ||
67 | |||
64 | /** | 68 | /** |
65 | * Function scheduled as very last function, cleans up after us | 69 | * Function scheduled as very last function, cleans up after us |
66 | *{{{ | 70 | *{{{ |
@@ -84,6 +88,16 @@ cleanup(void* cls __attribute__((unused)), const struct GNUNET_SCHEDULER_TaskCon | |||
84 | GNUNET_MESH_disconnect(mesh_handle); | 88 | GNUNET_MESH_disconnect(mesh_handle); |
85 | mesh_handle = NULL; | 89 | mesh_handle = NULL; |
86 | } | 90 | } |
91 | if (GNUNET_SCHEDULER_NO_TASK != shs_task) | ||
92 | { | ||
93 | GNUNET_SCHEDULER_cancel (shs_task); | ||
94 | shs_task = GNUNET_SCHEDULER_NO_TASK; | ||
95 | } | ||
96 | if (GNUNET_SCHEDULER_NO_TASK != conn_task) | ||
97 | { | ||
98 | GNUNET_SCHEDULER_cancel (conn_task); | ||
99 | conn_task = GNUNET_SCHEDULER_NO_TASK; | ||
100 | } | ||
87 | } | 101 | } |
88 | /*}}}*/ | 102 | /*}}}*/ |
89 | 103 | ||
@@ -733,8 +747,8 @@ run (void *cls, | |||
733 | GNUNET_CONFIGURATION_get_value_number (cfg, "vpn", "MAX_MAPPINGg", | 747 | GNUNET_CONFIGURATION_get_value_number (cfg, "vpn", "MAX_MAPPINGg", |
734 | &max_mappings); | 748 | &max_mappings); |
735 | udp_connections = GNUNET_CONTAINER_multihashmap_create(65536); | 749 | udp_connections = GNUNET_CONTAINER_multihashmap_create(65536); |
736 | GNUNET_SCHEDULER_TaskIdentifier conn_task = GNUNET_SCHEDULER_add_now (connect_to_service_dns, NULL); | 750 | conn_task = GNUNET_SCHEDULER_add_now (connect_to_service_dns, NULL); |
737 | GNUNET_SCHEDULER_add_after (conn_task, start_helper_and_schedule, NULL); | 751 | shs_task = GNUNET_SCHEDULER_add_after (conn_task, start_helper_and_schedule, NULL); |
738 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); | 752 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); |
739 | } | 753 | } |
740 | 754 | ||