summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2015-12-10 21:09:08 +0100
committerSimon Rettberg2015-12-10 21:09:08 +0100
commit75d0d1e37da67eec14ead23b58461dd46e3be12c (patch)
tree20797167e97a654077ed8500447279e10cc081b4
parent[SERVER] Add missing nullptr check from refactoring, improve locking (diff)
downloaddnbd3-fuse2.0.tar.gz
dnbd3-fuse2.0.tar.xz
dnbd3-fuse2.0.zip
[SERVER] Remove silly optimizationfuse2.0
-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 );
}