Skip to content

Commit

Permalink
fruity: Improve TcpTunnelConnection teardown
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
oleavr committed Nov 22, 2024
1 parent 36a8ffb commit 312e38b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/fruity/xpc.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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 ());
Expand All @@ -2004,6 +2003,9 @@ namespace Frida.Fruity {
} catch (GLib.Error e) {
}

if (_tunnel_netstack != null)
_tunnel_netstack.stop ();

close_request.resolve (true);

closed ();
Expand Down

0 comments on commit 312e38b

Please sign in to comment.