[libvirt] [PATCH 2/5] Ensure client is marked for close in all error paths

Eric Blake eblake at redhat.com
Thu Jul 19 17:50:49 UTC 2012


On 07/19/2012 09:04 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> Currently if the keepalive timer triggers, the 'markClose'
> flag is set on the virNetClient. A controlled shutdown will
> then be performed. If an I/O error occurs during read or
> write of the connection an error is raised back to the
> caller, but the connection isn't marked for close. This
> patch ensures that all I/O error scenarios always result
> in the connection being marked for close.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/rpc/virnetclient.c |   62 +++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 51 insertions(+), 11 deletions(-)
> 
> diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
> index f877934..33d4209 100644
> --- a/src/rpc/virnetclient.c
> +++ b/src/rpc/virnetclient.c
> @@ -101,6 +101,7 @@ struct _virNetClient {
>  
>      virKeepAlivePtr keepalive;
>      bool wantClose;
> +    int closeReason;

Hmm, I know in 1/5 that I mentioned that starting the enum at 0 instead
of 1 would allow VIR_ENUM translation; but here, if the reasons start at
1, then you can merge 'wantClose' and 'closeReason' into a single int
variable, 0 when the connection is open, and non-zero with the reason
when you want to close.

Everything else looks okay.  ACK.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120719/4adee661/attachment-0001.sig>


More information about the libvir-list mailing list