aboutgitcodebugslistschat
path: root/qrap.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-06-27 12:11:07 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-06-27 12:11:07 +0200
commitad6a00e9e6b46013cdb8e7476d9e648e837d7e84 (patch)
tree5549239dc940d15658e0e440e925e3def4b786f7 /qrap.c
parent2c13f6bead81185d245dd48d0ec2546a76727bdd (diff)
downloadpasst-ad6a00e9e6b46013cdb8e7476d9e648e837d7e84.tar
passt-ad6a00e9e6b46013cdb8e7476d9e648e837d7e84.tar.gz
passt-ad6a00e9e6b46013cdb8e7476d9e648e837d7e84.tar.bz2
passt-ad6a00e9e6b46013cdb8e7476d9e648e837d7e84.tar.lz
passt-ad6a00e9e6b46013cdb8e7476d9e648e837d7e84.tar.xz
passt-ad6a00e9e6b46013cdb8e7476d9e648e837d7e84.tar.zst
passt-ad6a00e9e6b46013cdb8e7476d9e648e837d7e84.zip
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 <sbrivio@redhat.com>
Diffstat (limited to 'qrap.c')
-rw-r--r--qrap.c12
1 files changed, 6 insertions, 6 deletions
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;
}