From 148fbf0d58a6fa9c6881db28fced8c071c3be100 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 19 Jan 2023 11:16:45 +0100 Subject: net: stream: add a new option to automatically reconnect 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 Signed-off-by: Jason Wang --- qapi/net.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'qapi') diff --git a/qapi/net.json b/qapi/net.json index 522ac582ed..d6eb30008b 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -585,6 +585,10 @@ # @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) +# (since 8.0) # # Only SocketAddress types 'unix', 'inet' and 'fd' are supported. # @@ -593,7 +597,8 @@ { 'struct': 'NetdevStreamOptions', 'data': { 'addr': 'SocketAddress', - '*server': 'bool' } } + '*server': 'bool', + '*reconnect': 'uint32' } } ## # @NetdevDgramOptions: -- cgit v1.2.3