From 938c8b79e5249d41469151e30268cfaf88bdb588 Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Mon, 5 Mar 2018 14:43:21 +0800 Subject: qio: store gsources for net listeners Originally we were storing the GSources tag IDs. That'll be not enough if we are going to support non-default gcontext for QIO code. Switch to GSources without changing anything real. Now we still always pass in NULL, which means the default gcontext. Signed-off-by: Peter Xu Signed-off-by: Daniel P. Berrangé --- include/io/net-listener.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/io/net-listener.h b/include/io/net-listener.h index 56d6da7a76..8081ac58a2 100644 --- a/include/io/net-listener.h +++ b/include/io/net-listener.h @@ -53,7 +53,7 @@ struct QIONetListener { char *name; QIOChannelSocket **sioc; - gulong *io_tag; + GSource **io_source; size_t nsioc; bool connected; @@ -120,17 +120,35 @@ void qio_net_listener_add(QIONetListener *listener, QIOChannelSocket *sioc); /** - * qio_net_listener_set_client_func: + * qio_net_listener_set_client_func_full: * @listener: the network listener object * @func: the callback function * @data: opaque data to pass to @func * @notify: callback to free @data + * @context: the context that the sources will be bound to. If %NULL, + * the default context will be used. * * Register @func to be invoked whenever a new client * connects to the listener. @func will be invoked * passing in the QIOChannelSocket instance for the * client. */ +void qio_net_listener_set_client_func_full(QIONetListener *listener, + QIONetListenerClientFunc func, + gpointer data, + GDestroyNotify notify, + GMainContext *context); + +/** + * qio_net_listener_set_client_func: + * @listener: the network listener object + * @func: the callback function + * @data: opaque data to pass to @func + * @notify: callback to free @data + * + * Wrapper of qio_net_listener_set_client_func_full(), only that the + * sources will always be bound to default main context. + */ void qio_net_listener_set_client_func(QIONetListener *listener, QIONetListenerClientFunc func, gpointer data, -- cgit v1.2.3-55-g7522