From 126827b14598e8d82bc35d7396b87d0f5a6a5e8f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philipp=20T=C3=B6lke?= Date: Thu, 24 Feb 2011 14:44:04 +0000 Subject: [PATCH] fix SIGSEGV if dns was slow to start up --- src/vpn/gnunet-daemon-vpn-dns.c | 5 ++++- src/vpn/gnunet-daemon-vpn-helper.c | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vpn/gnunet-daemon-vpn-dns.c b/src/vpn/gnunet-daemon-vpn-dns.c index 7d0b38d8c..07e2d6059 100644 --- a/src/vpn/gnunet-daemon-vpn-dns.c +++ b/src/vpn/gnunet-daemon-vpn-dns.c @@ -117,9 +117,12 @@ connect_to_service_dns (void *cls, GNUNET_assert (dns_connection == NULL); dns_connection = GNUNET_CLIENT_connect ("dns", cfg); /* This would most likely be a misconfiguration */ - GNUNET_assert(dns_connection != NULL); + 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, diff --git a/src/vpn/gnunet-daemon-vpn-helper.c b/src/vpn/gnunet-daemon-vpn-helper.c index 1317c9ade..9df2a8cc0 100644 --- a/src/vpn/gnunet-daemon-vpn-helper.c +++ b/src/vpn/gnunet-daemon-vpn-helper.c @@ -122,7 +122,8 @@ start_helper_and_schedule(void *cls, * The routing-table gets flushed if an interface disappears. */ restart_hijack = 1; - GNUNET_CLIENT_notify_transmit_ready(dns_connection, sizeof(struct GNUNET_MessageHeader), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &send_query, NULL); + if (NULL != dns_connection) + GNUNET_CLIENT_notify_transmit_ready(dns_connection, sizeof(struct GNUNET_MessageHeader), GNUNET_TIME_UNIT_FOREVER_REL, GNUNET_YES, &send_query, NULL); } /*}}}*/ -- 2.25.1