mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
virNetServerProcessClients: Remove goto
This gets rid of the goto and prepares the function for automatic mutex management. Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
0c4b391e2a
commit
42fccb4716
@ -960,13 +960,19 @@ virNetServerHasClients(virNetServer *srv)
|
||||
void
|
||||
virNetServerProcessClients(virNetServer *srv)
|
||||
{
|
||||
size_t i;
|
||||
size_t i = 0;
|
||||
|
||||
while (true) {
|
||||
virNetServerClient *client;
|
||||
bool removed = false;
|
||||
|
||||
virObjectLock(srv);
|
||||
|
||||
reprocess:
|
||||
for (i = 0; i < srv->nclients; i++) {
|
||||
if (i >= srv->nclients) {
|
||||
virObjectUnlock(srv);
|
||||
return;
|
||||
}
|
||||
|
||||
client = srv->clients[i];
|
||||
virObjectLock(client);
|
||||
if (virNetServerClientWantCloseLocked(client))
|
||||
@ -974,25 +980,27 @@ virNetServerProcessClients(virNetServer *srv)
|
||||
|
||||
if (virNetServerClientIsClosedLocked(client)) {
|
||||
VIR_DELETE_ELEMENT(srv->clients, i, srv->nclients);
|
||||
removed = true;
|
||||
|
||||
/* Update server authentication tracking */
|
||||
virNetServerSetClientAuthCompletedLocked(srv, client);
|
||||
virNetServerCheckLimits(srv);
|
||||
}
|
||||
|
||||
virObjectUnlock(client);
|
||||
|
||||
virNetServerCheckLimits(srv);
|
||||
|
||||
if (removed) {
|
||||
i = 0;
|
||||
virObjectUnlock(srv);
|
||||
virObjectUnref(client);
|
||||
virObjectLock(srv);
|
||||
continue;
|
||||
}
|
||||
|
||||
goto reprocess;
|
||||
} else {
|
||||
virObjectUnlock(client);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
|
||||
virObjectUnlock(srv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
|
Loading…
Reference in New Issue
Block a user