Make service ports lock-free

The service port list is now iterated in a safe and lock-free manner. This
makes the handling of service ports somewhat simpler since once an item
has been added to the list it will never be removed. It also removes the
need to lock the service when checking whether a service listens on a port
which caused potential deadlocks.
This commit is contained in:
Markus Mäkelä
2017-05-07 11:18:54 +03:00
parent 461cd6afd9
commit 717f883839
3 changed files with 71 additions and 78 deletions

View File

@ -47,6 +47,7 @@ typedef struct servlistener
struct users *users; /**< The user data for this listener */
struct service* service; /**< The service which used by this listener */
SPINLOCK lock;
int active; /**< True if the port has not been deleted */
struct servlistener *next; /**< Next service protocol */
} SERV_LISTENER;