stream-service: Restart accepting without blocking
authorTobias Brunner <tobias@strongswan.org>
Mon, 21 Jul 2014 09:30:34 +0000 (11:30 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 9 Sep 2014 08:58:58 +0000 (10:58 +0200)
commit22e90cad00c59d723a2edbf953d5e250e0462022
treefb792a1229cba9fc57d9280cac0b9d17bff83f2b
parente58764ca0f5996c8236cb11c71ff586fb97f47b9
stream-service: Restart accepting without blocking

Calling on_accept() sometimes lead to deadlocks when service->destroy()
was called concurrently.  That is, two threads waiting in on_accept() but
the last worker would only wake one due to the call to signal().  Calling
broadcast() wouldn't help either as that could lead to crashes if the thread
that called destroy() is woken first.

This is also more efficient as a constant pool of concurrent workers can
be maintained, otherwise peaks at the limit were followed by only a single
worker being active.
src/libstrongswan/networking/streams/stream_service.c