aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/daemon.c
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-10-16 10:57:02 +0200
committerTobias Brunner <tobias@strongswan.org>2012-10-18 10:57:55 +0200
commit292d8f41c3b39b8f8c6bede26de742c90120bf67 (patch)
treef79a78167402d5254c4557b6e18f97d2dc5457ca /src/libcharon/daemon.c
parent272ce5b5804fcaa4b9ca4b3c1f1f2e313cd22da3 (diff)
downloadstrongswan-292d8f41c3b39b8f8c6bede26de742c90120bf67.tar.bz2
strongswan-292d8f41c3b39b8f8c6bede26de742c90120bf67.tar.xz
Resolve hosts by DNS name in separate threads so we can cancel them
getaddrinfo(3) may block a long time so proper termination of the daemon may block if DNS servers are not reachable. getaddrinfo(3) is an optional cancellation point in posix threads so it might still block a shutdown but at least on Android (with the signal based pthread_cancel implementation) it works, on Linux starter will kill charon anyway after a while.
Diffstat (limited to 'src/libcharon/daemon.c')
-rw-r--r--src/libcharon/daemon.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libcharon/daemon.c b/src/libcharon/daemon.c
index 6e977efc4..9ae56a91d 100644
--- a/src/libcharon/daemon.c
+++ b/src/libcharon/daemon.c
@@ -84,7 +84,8 @@ static void destroy(private_daemon_t *this)
{
/* terminate all idle threads */
lib->processor->set_threads(lib->processor, 0);
-
+ /* make sure nobody waits for a DNS query */
+ lib->hosts->flush(lib->hosts);
/* close all IKE_SAs */
if (this->public.ike_sa_manager)
{