From 4e2d8bf6f143138ad121545a7cf4525e36040039 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Mon, 19 Aug 2019 15:29:58 +0200 Subject: socket: Add num connections to qio_channel_socket_sync() Reviewed-by: Daniel P. Berrangé Signed-off-by: Juan Quintela --- io/channel-socket.c | 7 ++++--- io/net-listener.c | 2 +- io/trace-events | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) (limited to 'io') diff --git a/io/channel-socket.c b/io/channel-socket.c index a533c8bc11..6258c25983 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -197,12 +197,13 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc, int qio_channel_socket_listen_sync(QIOChannelSocket *ioc, SocketAddress *addr, + int num, Error **errp) { int fd; - trace_qio_channel_socket_listen_sync(ioc, addr); - fd = socket_listen(addr, 1, errp); + trace_qio_channel_socket_listen_sync(ioc, addr, num); + fd = socket_listen(addr, num, errp); if (fd < 0) { trace_qio_channel_socket_listen_fail(ioc); return -1; @@ -226,7 +227,7 @@ static void qio_channel_socket_listen_worker(QIOTask *task, SocketAddress *addr = opaque; Error *err = NULL; - qio_channel_socket_listen_sync(ioc, addr, &err); + qio_channel_socket_listen_sync(ioc, addr, 1, &err); qio_task_set_error(task, err); } diff --git a/io/net-listener.c b/io/net-listener.c index d8cfe52673..dc81150318 100644 --- a/io/net-listener.c +++ b/io/net-listener.c @@ -82,7 +82,7 @@ int qio_net_listener_open_sync(QIONetListener *listener, for (i = 0; i < nresaddrs; i++) { QIOChannelSocket *sioc = qio_channel_socket_new(); - if (qio_channel_socket_listen_sync(sioc, resaddrs[i], + if (qio_channel_socket_listen_sync(sioc, resaddrs[i], 1, err ? NULL : &err) == 0) { success = true; diff --git a/io/trace-events b/io/trace-events index 378390521e..2e6aa1d749 100644 --- a/io/trace-events +++ b/io/trace-events @@ -17,7 +17,7 @@ qio_channel_socket_connect_sync(void *ioc, void *addr) "Socket connect sync ioc= qio_channel_socket_connect_async(void *ioc, void *addr) "Socket connect async ioc=%p addr=%p" qio_channel_socket_connect_fail(void *ioc) "Socket connect fail ioc=%p" qio_channel_socket_connect_complete(void *ioc, int fd) "Socket connect complete ioc=%p fd=%d" -qio_channel_socket_listen_sync(void *ioc, void *addr) "Socket listen sync ioc=%p addr=%p" +qio_channel_socket_listen_sync(void *ioc, void *addr, int num) "Socket listen sync ioc=%p addr=%p num=%d" qio_channel_socket_listen_async(void *ioc, void *addr) "Socket listen async ioc=%p addr=%p" qio_channel_socket_listen_fail(void *ioc) "Socket listen fail ioc=%p" qio_channel_socket_listen_complete(void *ioc, int fd) "Socket listen complete ioc=%p fd=%d" -- cgit v1.2.3-55-g7522