From 8775c6fb949acecca39f006f18a32bac5c009e5d Mon Sep 17 00:00:00 2001 From: Ondrej Holy Date: Fri, 24 Aug 2018 15:11:58 +0200 Subject: [PATCH 2/3] Properly remove watches when changing server props vino_server_init_io_channels calls vino_server_deinit_io_channels at the beginning, however the watches and channels don't have to be removed respective closed, because it relies on rfbListenSock array, which can be already modified as a consequence of changing server properties. Let's call vino_server_deinit_io_channels before changing server properties in order to prevent the following errors: rfbCheckFds: accept: Invalid argument https://bugzilla.gnome.org/show_bug.cgi?id=796349 --- server/vino-server.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/server/vino-server.c b/server/vino-server.c index b8cd755..7e5599b 100644 --- a/server/vino-server.c +++ b/server/vino-server.c @@ -963,8 +963,6 @@ vino_server_init_io_channels(VinoServer *server) rfbScreenInfoPtr rfb_screen = server->priv->rfb_screen; int i; - vino_server_deinit_io_channels (server); - dprintf (RFB, "Creating watch for listening socket [ "); for (i=0; i < rfb_screen->rfbListenSockTotal; i++) { @@ -1085,6 +1083,7 @@ vino_server_init_from_screen (VinoServer *server, vino_server_update_security_types (server); + vino_server_deinit_io_channels (server); vino_server_init_io_channels (server); vino_mdns_add_service ("_rfb._tcp", rfb_screen->rfbPort); @@ -1624,7 +1623,12 @@ vino_server_set_network_interface (VinoServer *server, server->priv->network_interface = NULL; if (server->priv->rfb_screen != NULL) - rfbSetNetworkInterface (server->priv->rfb_screen, server->priv->network_interface); + { + vino_server_deinit_io_channels (server); + rfbSetNetworkInterface (server->priv->rfb_screen, server->priv->network_interface); + vino_server_init_io_channels (server); + vino_server_control_upnp (server); + } g_object_notify (G_OBJECT (server), "network-interface"); } @@ -1651,6 +1655,8 @@ vino_server_set_use_alternative_port (VinoServer *server, if (server->priv->rfb_screen) { + vino_server_deinit_io_channels (server); + if (server->priv->use_alternative_port) rfbSetPort (server->priv->rfb_screen, server->priv->alternative_port); @@ -1688,6 +1694,7 @@ vino_server_set_alternative_port (VinoServer *server, if (server->priv->rfb_screen && server->priv->use_alternative_port) { + vino_server_deinit_io_channels (server); rfbSetPort (server->priv->rfb_screen, server->priv->alternative_port); vino_server_init_io_channels (server); vino_server_control_upnp (server); -- 2.17.1