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>
This commit is contained in:
parent
2c13f6bead
commit
ad6a00e9e6
1 changed files with 6 additions and 6 deletions
12
qrap.c
12
qrap.c
|
@ -234,7 +234,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
valid_args:
|
valid_args:
|
||||||
for (i = 1; i < UNIX_SOCK_MAX; i++) {
|
for (i = 1; i < UNIX_SOCK_MAX; i++) {
|
||||||
retry_on_reset = 1;
|
retry_on_reset = 5;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
s = socket(AF_UNIX, SOCK_STREAM, 0);
|
s = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||||
|
@ -269,9 +269,9 @@ retry:
|
||||||
* connection because the previous one is still active. This
|
* connection because the previous one is still active. This
|
||||||
* overlap seems to be anywhere between 0 and 3ms.
|
* overlap seems to be anywhere between 0 and 3ms.
|
||||||
*
|
*
|
||||||
* If we get a connection reset, retry, just once, after 100ms,
|
* If we get a connection reset, retry a few times, to allow for
|
||||||
* to allow for the previous qemu instance to terminate and, in
|
* the previous qemu instance to terminate and, in turn, for the
|
||||||
* turn, for the connection to passt to be closed.
|
* connection to passt to be closed.
|
||||||
*
|
*
|
||||||
* This should be fixed in libvirt instead. It probably makes
|
* This should be fixed in libvirt instead. It probably makes
|
||||||
* sense to check this behaviour once native libvirt support is
|
* sense to check this behaviour once native libvirt support is
|
||||||
|
@ -281,8 +281,8 @@ retry:
|
||||||
* obsoleted.
|
* obsoleted.
|
||||||
*/
|
*/
|
||||||
if (retry_on_reset && errno == ECONNRESET) {
|
if (retry_on_reset && errno == ECONNRESET) {
|
||||||
retry_on_reset = 0;
|
retry_on_reset--;
|
||||||
usleep(100 * 1000);
|
usleep(50 * 1000);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue