In qemu-nbd and other NBD server setups where parallel clients are supported, it is common that the caller will re-register the same callback function as long as it has not reached its limit on simultaneous clients. In that case, there is no need to tear down and reinstall GSource watches in the GMainContext.
Signed-off-by: Eric Blake <[email protected]> --- io/net-listener.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/io/net-listener.c b/io/net-listener.c index 0adbc409cf2..e89286ea63c 100644 --- a/io/net-listener.c +++ b/io/net-listener.c @@ -147,6 +147,10 @@ void qio_net_listener_set_client_func_full(QIONetListener *listener, { size_t i; + if (listener->io_func == func && listener->io_data == data) { + return; + } + if (listener->io_func) { trace_qio_net_listener_watch_disabled(listener, "set_client_func"); } -- 2.51.1
