Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e6175ff authored by anga's avatar anga Committed by Steve Kondik
Browse files

Fix a race condition in NativeDaemonConnector

Fixes a race between the onDaemonConnected callback and setting the
mOutputStream in NativeDaemonConnector.

MountService connects to vold using the NativeDaemonConnector.
Throws a “NativeDaemonConnectorException: No output stream!”
when the onDaemonConnected callback in MountService calls the doListCommand.

Change-Id: Ib895bab37f7df680e4362df6366198c0a673c5e9
parent 84d9c2af
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -97,11 +97,12 @@ final class NativeDaemonConnector implements Runnable {
                    LocalSocketAddress.Namespace.RESERVED);

            socket.connect(address);
            mCallbacks.onDaemonConnected();

            InputStream inputStream = socket.getInputStream();
            mOutputStream = socket.getOutputStream();

            mCallbacks.onDaemonConnected();

            byte[] buffer = new byte[BUFFER_SIZE];
            int start = 0;