mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-05 00:00:45 -04:00
host-resolver: Don't wait for a reply if there are no threads
Without threads handling the resolution, there is no point waiting for a reply. If no subsequent resolution successfully starts a thread (there might not even be one), we'd wait indefinitely. Fixes #3634.
This commit is contained in:
parent
9248f636b0
commit
7d2d94f3e1
@ -287,7 +287,20 @@ METHOD(host_resolver_t, resolve, host_t*,
|
||||
this->pool->insert_last(this->pool, thread);
|
||||
}
|
||||
}
|
||||
query->done->wait(query->done, this->mutex);
|
||||
if (this->threads)
|
||||
{
|
||||
query->done->wait(query->done, this->mutex);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBG1(DBG_LIB, "resolving '%s' failed: no resolver threads", query->name);
|
||||
/* this should always be the case if we end up here, but make sure */
|
||||
if (query->refcount == 1)
|
||||
{
|
||||
this->queries->remove(this->queries, query);
|
||||
this->queue->remove_last(this->queue, (void**)&query);
|
||||
}
|
||||
}
|
||||
this->mutex->unlock(this->mutex);
|
||||
|
||||
result = query->result ? query->result->clone(query->result) : NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user