summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/server/server.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/server/server.c b/src/server/server.c
index f7aba2a..0649e9e 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -408,11 +408,11 @@ void dnbd3_removeClient(dnbd3_client_t *client)
{
int i;
spin_lock( &_clients_lock );
- const int cutoff = MAX(10, _num_clients / 2);
for (i = _num_clients - 1; i >= 0; --i) {
- if ( _clients[i] != client ) continue;
- _clients[i] = NULL;
- if ( i > cutoff && i + 1 == _num_clients ) --_num_clients;
+ if ( _clients[i] == client ) {
+ _clients[i] = NULL;
+ }
+ if ( _clients[i] == NULL && i + 1 == _num_clients ) --_num_clients;
}
spin_unlock( &_clients_lock );
}