[Libguestfs] [PATCH nbdkit v2 7/9] tests/test-retry-request-mirror.c: Don't assume state after connect
Eric Blake
eblake at redhat.com
Mon Jul 31 15:12:43 UTC 2023
On Fri, Jul 28, 2023 at 06:17:51PM +0100, Richard W.M. Jones wrote:
> After forthcoming changes to the curl plugin we cannot assume the
> exact mirror we will be connected to after making the NBD connection.
> So remove that assumption.
>
> See: commit 38dccd848bd40cccdf012df7a606e13282aaeecb
> ---
> tests/test-retry-request-mirror.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tests/test-retry-request-mirror.c b/tests/test-retry-request-mirror.c
> index cf42c5964..65440d2e5 100644
> --- a/tests/test-retry-request-mirror.c
> +++ b/tests/test-retry-request-mirror.c
> @@ -58,7 +58,7 @@ main (int argc, char *argv[])
> const char *sockpath;
> CLEANUP_FREE char *usp_param = NULL;
> int i, j;
> - char state = 0;
> + char state;
> struct nbd_handle *nbd = NULL;
>
> #ifndef HAVE_CURLOPT_UNIX_SOCKET_PATH
> @@ -105,6 +105,8 @@ main (int argc, char *argv[])
> if (nbd_connect_unix (nbd, sock /* NBD socket */) == -1)
> goto nbd_error;
>
> + state = 0;
> +
Took me a while to see it, but you are changing it so that state
starts at 0 on every iteration of the outer loop, rather than just
once before starting the outer loop. The bit about possibly having
more than one connection (because a different mirror gets selected)
makes sense for that change.
Reviewed-by: Eric Blake <eblake at redhat.com>
> for (i = 0; i < 7 /* not divisible by 2 or 3 */; ++i) {
> char buf[512];
>
> --
> 2.41.0
>
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://listman.redhat.com/mailman/listinfo/libguestfs
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization: qemu.org | libguestfs.org
More information about the Libguestfs
mailing list