diff mbox series

[4/4] char-socket: restart the reconnect timer to switch context

Message ID 20190220160628.6555-5-marcandre.lureau@redhat.com
State New
Headers show
Series RFC: make chardev context switching safer | expand

Commit Message

Marc-André Lureau Feb. 20, 2019, 4:06 p.m. UTC
The reconnect timer is not switched to the given context, fix it.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 chardev/char-socket.c | 5 +++++
 1 file changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 4fcdd8aedd..671861f98c 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -632,6 +632,11 @@  static void tcp_chr_update_read_handler(Chardev *chr)
 {
     SocketChardev *s = SOCKET_CHARDEV(chr);
 
+    if (s->reconnect_timer) {
+        tcp_chr_reconn_timer_cancel(s);
+        qemu_chr_socket_restart_timer(chr);
+    }
+
     if (s->listener) {
         /*
          * It's possible that chardev context is changed in