[Libvir] PATCH: Force close of virConnectPtr if client quits abnormally

Daniel Veillard veillard at redhat.com
Thu Jul 12 07:24:18 UTC 2007


On Thu, Jul 12, 2007 at 12:39:48AM +0100, Daniel P. Berrange wrote:
> If a remote client quits abnormally (or if the server forcably drops a
> client for misbehaviing), it is possible that the virConnectPtr object
> is not closed. This leads to a build up of active connections in the
> server. The attached patch simply calls virConnectClose when killing off
> a client connection if there is a non-NULL client->conn object.
> 
> Dan.
> -- 
> |=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
> |=-           Perl modules: http://search.cpan.org/~danberr/              -=|
> |=-               Projects: http://freshmeat.net/~danielpb/               -=|
> |=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 

> diff -u -p -r1.52 qemud.c
> --- qemud/qemud.c	26 Jun 2007 23:48:47 -0000	1.52
> +++ qemud/qemud.c	11 Jul 2007 23:37:10 -0000
> @@ -1023,6 +1036,9 @@ static void qemudDispatchClientFailure(s
>  
>      virEventRemoveHandleImpl(client->fd);
>  
> +    if (client->conn)
> +        virConnectClose(client->conn);
> +
>      if (client->tls && client->session) gnutls_deinit (client->session);
>      close(client->fd);
>      free(client);

  makes sense +1

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/




More information about the libvir-list mailing list