aboutsummaryrefslogtreecommitdiff
path: root/chardev/char-socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'chardev/char-socket.c')
-rw-r--r--chardev/char-socket.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index d6de5d2305..7db20ff0a0 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -957,8 +957,15 @@ static int tcp_chr_wait_connected(Chardev *chr, Error **errp)
if (s->is_listen) {
tcp_chr_accept_server_sync(chr);
} else {
- if (tcp_chr_connect_client_sync(chr, errp) < 0) {
- return -1;
+ Error *err = NULL;
+ if (tcp_chr_connect_client_sync(chr, &err) < 0) {
+ if (s->reconnect_time) {
+ error_free(err);
+ g_usleep(s->reconnect_time * 1000ULL * 1000ULL);
+ } else {
+ error_propagate(errp, err);
+ return -1;
+ }
}
}
}