diff options
author | Philipp Tölke <toelke@in.tum.de> | 2010-10-07 05:41:58 +0000 |
---|---|---|
committer | Philipp Tölke <toelke@in.tum.de> | 2010-10-07 05:41:58 +0000 |
commit | 2d60ec0a85a587b802c4b10c6f89f30618cdab69 (patch) | |
tree | fbc381767507d501e29f925e965e455989fca37c /src | |
parent | a55e184722c9606ceb01bcb4579d5160f3d64e73 (diff) | |
download | gnunet-2d60ec0a85a587b802c4b10c6f89f30618cdab69.tar.gz gnunet-2d60ec0a85a587b802c4b10c6f89f30618cdab69.zip |
Disconnect from service-dns only when connected
Diffstat (limited to 'src')
-rw-r--r-- | src/vpn/gnunet-daemon-vpn.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vpn/gnunet-daemon-vpn.c b/src/vpn/gnunet-daemon-vpn.c index 354e090d8..5660aff7b 100644 --- a/src/vpn/gnunet-daemon-vpn.c +++ b/src/vpn/gnunet-daemon-vpn.c | |||
@@ -259,13 +259,17 @@ static void message_token(void *cls, void *client, const struct GNUNET_MessageHe | |||
259 | void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg); | 259 | void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg); |
260 | 260 | ||
261 | void reconnect_to_service_dns() { | 261 | void reconnect_to_service_dns() { |
262 | mycls.dns_connection = GNUNET_CLIENT_connect (mycls.sched, "dns", mycls.cfg); | 262 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Connecting\n"); |
263 | if (mycls.dns_connection != NULL) { | ||
264 | GNUNET_CLIENT_disconnect(mycls.dns_connection, 1); | ||
265 | } | ||
266 | mycls.dns_connection = GNUNET_CLIENT_connect (mycls.sched, "dns", mycls.cfg); | ||
263 | 267 | ||
264 | GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL); | 268 | GNUNET_CLIENT_receive(mycls.dns_connection, &dns_answer_handler, NULL, GNUNET_TIME_UNIT_FOREVER_REL); |
265 | } | 269 | } |
266 | 270 | ||
267 | void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) { | 271 | void dns_answer_handler(void* cls, const struct GNUNET_MessageHeader *msg) { |
268 | if (msg == NULL) reconnect_to_service_dns(); | 272 | if (msg == NULL) return reconnect_to_service_dns(); |
269 | 273 | ||
270 | if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS)) goto out; | 274 | if (msg->type != htons(GNUNET_MESSAGE_TYPE_LOCAL_RESPONSE_DNS)) goto out; |
271 | 275 | ||