diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index cc408dc62..354e090d8 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c | |||
@@ -56,6 +56,8 @@ struct vpn_cls { | |||
56 | 56 | ||
57 | pid_t helper_pid; | 57 | pid_t helper_pid; |
58 | 58 | ||
59 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
60 | |||
59 | struct query_packet_list *head; | 61 | struct query_packet_list *head; |
60 | struct query_packet_list *tail; | 62 | struct query_packet_list *tail; |
61 | 63 | ||
@@ -254,8 +256,16 @@ static void message_token(void *cls, void *client, const struct GNUNET_MessageHe | |||
254 | 256 | ||
255 | } | 257 | } |
256 | 258 | ||
259 | void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg); | ||
260 | |||
261 | void reconnect_to_service_dns() { | ||
262 | mycls.dns_connection = GNUNET_CLIENT_connect (mycls.sched, "dns", mycls.cfg); | ||
263 | |||
264 | GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL); | ||
265 | } | ||
266 | |||
257 | void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) { | 267 | void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) { |
258 | if (msg == NULL) return; | 268 | if (msg == NULL) reconnect_to_service_dns(); |
259 | 269 | ||
260 | if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS)) goto out; | 270 | if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS)) goto out; |
261 | 271 | ||
@@ -290,9 +300,9 @@ run (void *cls, | |||
290 | mycls.sched = sched; | 300 | mycls.sched = sched; |
291 | mycls.mst = GNUNET_SERVER_mst_create(&message_token, NULL); | 301 | mycls.mst = GNUNET_SERVER_mst_create(&message_token, NULL); |
292 | 302 | ||
293 | mycls.dns_connection = GNUNET_CLIENT_connect (sched, "dns", cfg); | 303 | mycls.cfg = cfg; |
294 | 304 | ||
295 | GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL); | 305 | reconnect_to_service_dns(); |
296 | 306 | ||
297 | GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); | 307 | GNUNET_SCHEDULER_add_delayed(sched, GNUNET_TIME_UNIT_FOREVER_REL, &cleanup, cls); |
298 | start_helper_and_schedule(mycls); | 308 | start_helper_and_schedule(mycls); |