kernel-netlink: Directly handle Netlink messages if thread pool is empty
authorTobias Brunner <tobias@strongswan.org>
Wed, 12 Apr 2017 13:18:45 +0000 (15:18 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 23 May 2017 14:49:39 +0000 (16:49 +0200)
During initialization of the plugins the thread pool is not yet
initialized so there is no watcher thread that could handle the queued
Netlink message and the main thread will wait indefinitely for a
response.

Fixes #2199.

src/libcharon/plugins/kernel_netlink/kernel_netlink_shared.c

index da54031..cf85cb0 100644 (file)
@@ -333,7 +333,8 @@ static status_t send_once(private_netlink_socket_t *this, struct nlmsghdr *in,
        while (!entry->complete)
        {
                if (this->parallel &&
-                       lib->watcher->get_state(lib->watcher) != WATCHER_STOPPED)
+                       lib->watcher->get_state(lib->watcher) != WATCHER_STOPPED &&
+                       lib->processor->get_total_threads(lib->processor))
                {
                        if (this->timeout)
                        {