MEDIUM: threads/server: Add a lock per server and atomically update server vars
The server's lock is use, among other things, to lock acces to the active
connection list of a server.
diff --git a/src/stats.c b/src/stats.c
index 66e9be4..e026f36 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -2880,9 +2880,11 @@
if (px->state != PR_STSTOPPED) {
struct stream *sess, *sess_bck;
+ SPIN_LOCK(SERVER_LOCK, &sv->lock);
list_for_each_entry_safe(sess, sess_bck, &sv->actconns, by_srv)
if (sess->srv_conn == sv)
stream_shutdown(sess, SF_ERR_KILLED);
+ SPIN_UNLOCK(SERVER_LOCK, &sv->lock);
altered_servers++;
total_servers++;