varlink: handle NULL varlink server object gracefully in varlink_server_current_connections()
let's treat a NULL server as a server with zero connections, to make things more convenient to use.
This commit is contained in:
committed by
Luca Boccassi
parent
4db747b0dd
commit
26279199cf
@@ -3987,7 +3987,9 @@ int varlink_server_set_connections_max(VarlinkServer *s, unsigned m) {
|
||||
}
|
||||
|
||||
unsigned varlink_server_current_connections(VarlinkServer *s) {
|
||||
assert_return(s, UINT_MAX);
|
||||
|
||||
if (!s) /* Unallocated servers have zero connections */
|
||||
return 0;
|
||||
|
||||
return s->n_connections;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user