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
This commit is contained in:
anga
2011-02-01 14:10:25 +01:00
committed by Brad Fitzpatrick
parent 56451a4477
commit c4faee0b10

View File

@@ -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;