[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] net: stream: add a new option to automatically reconnect
From: |
Thomas Huth |
Subject: |
Re: [PATCH v2] net: stream: add a new option to automatically reconnect |
Date: |
Tue, 3 Jan 2023 15:28:03 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 |
On 03/01/2023 15.22, Laurent Vivier wrote:
In stream mode, if the server shuts down there is currently
no way to reconnect the client to a new server without removing
the NIC device and the netdev backend (or to reboot).
This patch introduces a reconnect option that specifies a delay
to try to reconnect with the same parameters.
Add a new test in qtest to test the reconnect option and the
connect/disconnect events.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
Based-on: <20230103110049.120340-1-lvivier@redhat.com>
v2:
- rebase
net/stream.c | 53 ++++++++++++++++++-
qapi/net.json | 6 ++-
qemu-options.hx | 6 +--
tests/qtest/netdev-socket.c | 100 ++++++++++++++++++++++++++++++++++++
4 files changed, 160 insertions(+), 5 deletions(-)
[...]
diff --git a/qapi/net.json b/qapi/net.json
index 522ac582edeb..5b72c936b3ac 100644
--- a/qapi/net.json
+++ b/qapi/net.json
@@ -585,6 +585,9 @@
# @addr: socket address to listen on (server=true)
# or connect to (server=false)
# @server: create server socket (default: false)
+# @reconnect: For a client socket, if a socket is disconnected,
+# then attempt a reconnect after the given number of seconds.
+# Setting this to zero disables this function. (default: 0)
I think this should get a "(since 8.0)" comment to make it clear when it has
been introduced?
Thomas
#
# Only SocketAddress types 'unix', 'inet' and 'fd' are supported.
#
@@ -593,7 +596,8 @@
{ 'struct': 'NetdevStreamOptions',
'data': {
'addr': 'SocketAddress',
- '*server': 'bool' } }
+ '*server': 'bool',
+ '*reconnect': 'uint32' } }
##
# @NetdevDgramOptions: