diff options
Diffstat (limited to 'src/rpc/virnetserverservice.c')
-rw-r--r-- | src/rpc/virnetserverservice.c | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c index 000b5b6b9..eda5ef91c 100644 --- a/src/rpc/virnetserverservice.c +++ b/src/rpc/virnetserverservice.c @@ -69,40 +69,21 @@ static void virNetServerServiceAccept(virNetSocketPtr sock, void *opaque) { virNetServerServicePtr svc = opaque; - virNetServerClientPtr client = NULL; virNetSocketPtr clientsock = NULL; if (virNetSocketAccept(sock, &clientsock) < 0) - goto error; + goto cleanup; if (!clientsock) /* Connection already went away */ goto cleanup; - if (!(client = virNetServerClientNew(clientsock, - svc->auth, - svc->readonly, - svc->nrequests_client_max, - svc->tls))) - goto error; - if (!svc->dispatchFunc) - goto error; - - if (svc->dispatchFunc(svc, client, svc->dispatchOpaque) < 0) - virNetServerClientClose(client); + goto cleanup; - virObjectUnref(client); + svc->dispatchFunc(svc, clientsock, svc->dispatchOpaque); cleanup: - return; - -error: - if (client) { - virNetServerClientClose(client); - virObjectUnref(client); - } else { - virObjectUnref(clientsock); - } + virObjectUnref(clientsock); } @@ -240,6 +221,17 @@ bool virNetServerServiceIsReadonly(virNetServerServicePtr svc) } +size_t virNetServerServiceGetMaxRequests(virNetServerServicePtr svc) +{ + return svc->nrequests_client_max; +} + +virNetTLSContextPtr virNetServerServiceGetTLSContext(virNetServerServicePtr svc) +{ + return svc->tls; +} + + void virNetServerServiceSetDispatcher(virNetServerServicePtr svc, virNetServerServiceDispatchFunc func, void *opaque) |