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 <peterx@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
committed by
Daniel P. Berrangé
parent
315409c711
commit
938c8b79e5
@@ -53,7 +53,7 @@ struct QIONetListener {
|
||||
|
||||
char *name;
|
||||
QIOChannelSocket **sioc;
|
||||
gulong *io_tag;
|
||||
GSource **io_source;
|
||||
size_t nsioc;
|
||||
|
||||
bool connected;
|
||||
@@ -119,6 +119,26 @@ int qio_net_listener_open_sync(QIONetListener *listener,
|
||||
void qio_net_listener_add(QIONetListener *listener,
|
||||
QIOChannelSocket *sioc);
|
||||
|
||||
/**
|
||||
* 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
|
||||
@@ -126,10 +146,8 @@ void qio_net_listener_add(QIONetListener *listener,
|
||||
* @data: opaque data to pass to @func
|
||||
* @notify: callback to free @data
|
||||
*
|
||||
* 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.
|
||||
* 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,
|
||||
|
||||
Reference in New Issue
Block a user