From ad6a00e9e6b46013cdb8e7476d9e648e837d7e84 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Mon, 27 Jun 2022 12:11:07 +0200 Subject: qrap: Change number of retries and delay on connection reset One retry after 100ms was enough for static builds, where qrap takes a while to start, but it's sometimes not enough with regular builds. Switch that to five retries with 50ms delay. Signed-off-by: Stefano Brivio --- qrap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'qrap.c') diff --git a/qrap.c b/qrap.c index 303e981..834b46e 100644 --- a/qrap.c +++ b/qrap.c @@ -234,7 +234,7 @@ int main(int argc, char **argv) valid_args: for (i = 1; i < UNIX_SOCK_MAX; i++) { - retry_on_reset = 1; + retry_on_reset = 5; retry: s = socket(AF_UNIX, SOCK_STREAM, 0); @@ -269,9 +269,9 @@ retry: * connection because the previous one is still active. This * overlap seems to be anywhere between 0 and 3ms. * - * If we get a connection reset, retry, just once, after 100ms, - * to allow for the previous qemu instance to terminate and, in - * turn, for the connection to passt to be closed. + * If we get a connection reset, retry a few times, to allow for + * the previous qemu instance to terminate and, in turn, for the + * connection to passt to be closed. * * This should be fixed in libvirt instead. It probably makes * sense to check this behaviour once native libvirt support is @@ -281,8 +281,8 @@ retry: * obsoleted. */ if (retry_on_reset && errno == ECONNRESET) { - retry_on_reset = 0; - usleep(100 * 1000); + retry_on_reset--; + usleep(50 * 1000); goto retry; } -- cgit v1.2.3