Skip to content

Commit

Permalink
network-stack: Fix race in TcpInputStream.read()
Browse files Browse the repository at this point in the history
Where the notify::pending-io signal fires after the call to
is_readable() but before our signal handler is connected.
  • Loading branch information
oleavr committed Sep 20, 2024
1 parent 416d2ea commit ca8519c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/fruity/network-stack.vala
Original file line number Diff line number Diff line change
Expand Up @@ -765,10 +765,12 @@ namespace Frida.Fruity {
});
}

mutex.lock ();
while (!done)
cond.wait (mutex);
mutex.unlock ();
if (!is_readable ()) {
mutex.lock ();
while (!done)
cond.wait (mutex);
mutex.unlock ();
}

if (cancellation_handler != 0)
cancellable.disconnect (cancellation_handler);
Expand Down

0 comments on commit ca8519c

Please sign in to comment.