From 312e38b2ecb8877ec7b183ba728854eebbdf5648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Fri, 22 Nov 2024 14:45:59 +0100 Subject: [PATCH] fruity: Improve TcpTunnelConnection teardown So the VirtualNetworkStack is torn down right away upon the remote end closing the connection, instead of once close() is called. Also ensure any pending write operation is cancelled at that point. --- src/fruity/xpc.vala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/fruity/xpc.vala b/src/fruity/xpc.vala index 54f0d4a3e..1d018caf4 100644 --- a/src/fruity/xpc.vala +++ b/src/fruity/xpc.vala @@ -1979,9 +1979,6 @@ namespace Frida.Fruity { } catch (Error e) { assert_not_reached (); } - - if (_tunnel_netstack != null) - _tunnel_netstack.stop (); } private async void process_incoming_messages () { @@ -1994,6 +1991,8 @@ namespace Frida.Fruity { } catch (GLib.Error e) { } + io_cancellable.cancel (); + var source = new IdleSource (); source.set_callback (process_incoming_messages.callback); source.attach (MainContext.get_thread_default ()); @@ -2004,6 +2003,9 @@ namespace Frida.Fruity { } catch (GLib.Error e) { } + if (_tunnel_netstack != null) + _tunnel_netstack.stop (); + close_request.resolve (true); closed ();