On 6/25/19 8:32 AM, Markus Armbruster wrote: > I apologize for dragging my feet on this review. > > Vladimir Sementsov-Ogievskiy writes: > >> It's needed to provide keepalive for nbd client to track server >> availability. >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy >> --- >> >> +++ b/qapi/sockets.json >> @@ -53,6 +53,9 @@ >> # >> # @ipv6: whether to accept IPv6 addresses, default try both IPv4 and IPv6 >> # >> +# @keep-alive: enable keep-alive when connecting to this socket. Not supported >> +# for server-side connections. (Since 4.1) It looks like this missed 4.1. Are you planning on sending v4, to address >> +# > > Is "server-side connection" is an established term? > > For what it's worth, "passive socket" is, see listen(2). > >> # Since: 1.3 >> ## >> { 'struct': 'InetSocketAddress', >> @@ -61,7 +64,8 @@ >> '*numeric': 'bool', >> '*to': 'uint16', >> '*ipv4': 'bool', >> - '*ipv6': 'bool' } } >> + '*ipv6': 'bool', >> + '*keep-alive': 'bool' } } >> >> ## >> # @UnixSocketAddress: >> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c >> index 8850a280a8..813063761b 100644 >> --- a/util/qemu-sockets.c >> +++ b/util/qemu-sockets.c >> @@ -438,6 +438,12 @@ int inet_connect_saddr(InetSocketAddress *saddr, Error **errp) >> struct addrinfo *res, *e; >> int sock = -1; >> >> + if (saddr->keep_alive) { >> + error_setg(errp, "keep-alive options is not supported for server-side " >> + "connection"); >> + return -1; >> + } >> + >> res = inet_parse_connect_saddr(saddr, errp); >> if (!res) { >> return -1; > > I'm afraid you added this to the wrong function; ... > >> @@ -457,6 +463,19 @@ int inet_connect_saddr(InetSocketAddress *saddr, Error **errp) >> } >> >> freeaddrinfo(res); >> + >> + if (saddr->keep_alive) { > > ... it renders this code unreachable. > > I guess the "not supported for passive sockets" check should go into > inet_listen_saddr() instead. this comment? -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org