From: Daniel P. Berrangé Date: Mon, 11 Feb 2019 18:24:30 +0000 (+0000) Subject: chardev: forbid 'reconnect' option with server sockets X-Git-Tag: v4.0.0-rc0~100^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a0582f65648052bf6b1b572312500f6647a1eb0;p=thirdparty%2Fqemu.git chardev: forbid 'reconnect' option with server sockets The 'reconnect' option is used to give the sleep time, in seconds, before a client socket attempts to re-establish a connection to the server. It does not make sense to set this for server sockets, as they will always accept a new client connection immediately after the previous one went away. Reviewed-by: Marc-André Lureau Reviewed-by: Thomas Huth Signed-off-by: Daniel P. Berrangé Message-Id: <20190211182442.8542-5-berrange@redhat.com> Signed-off-by: Marc-André Lureau --- diff --git a/chardev/char-socket.c b/chardev/char-socket.c index e85250b6244..743b7b11cd1 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -1035,7 +1035,14 @@ static bool qmp_chardev_validate_socket(ChardevSocket *sock, } /* Validate any options which have a dependancy on client vs server */ - if (!(sock->has_server && sock->server)) { + if (!sock->has_server || sock->server) { + if (sock->has_reconnect) { + error_setg(errp, + "'reconnect' option is incompatible with " + "socket in server listen mode"); + return false; + } + } else { if (sock->has_websocket && sock->websocket) { error_setg(errp, "%s", "Websocket client is not implemented"); return false;