serve: Allow number of clients currently being used to be counted
This commit is contained in:
14
src/serve.c
14
src/serve.c
@@ -326,6 +326,20 @@ int cleanup_and_find_client_slot(struct server* params)
|
|||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int server_count_clients( struct server *params )
|
||||||
|
{
|
||||||
|
NULLCHECK( params );
|
||||||
|
int i, count = 0;
|
||||||
|
|
||||||
|
for ( i = 0 ; i < params->max_nbd_clients ; i++ ) {
|
||||||
|
if ( params->nbd_client[i].thread != 0 ) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Check whether the address client_address is allowed or not according
|
/** Check whether the address client_address is allowed or not according
|
||||||
* to the current acl. If params->acl is NULL, the result will be 1,
|
* to the current acl. If params->acl is NULL, the result will be 1,
|
||||||
|
@@ -137,6 +137,9 @@ void server_close_clients( struct server *serve );
|
|||||||
void server_join_clients( struct server *serve );
|
void server_join_clients( struct server *serve );
|
||||||
void server_allow_new_clients( struct server *serve );
|
void server_allow_new_clients( struct server *serve );
|
||||||
|
|
||||||
|
/* Returns a count (ish) of the number of currently-running client threads */
|
||||||
|
int server_count_clients( struct server *params );
|
||||||
|
|
||||||
void server_unlink( struct server * serve );
|
void server_unlink( struct server * serve );
|
||||||
|
|
||||||
int do_serve( struct server *, struct self_pipe * );
|
int do_serve( struct server *, struct self_pipe * );
|
||||||
|
Reference in New Issue
Block a user