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:
@@ -97,11 +97,12 @@ final class NativeDaemonConnector implements Runnable {
|
|||||||
LocalSocketAddress.Namespace.RESERVED);
|
LocalSocketAddress.Namespace.RESERVED);
|
||||||
|
|
||||||
socket.connect(address);
|
socket.connect(address);
|
||||||
mCallbacks.onDaemonConnected();
|
|
||||||
|
|
||||||
InputStream inputStream = socket.getInputStream();
|
InputStream inputStream = socket.getInputStream();
|
||||||
mOutputStream = socket.getOutputStream();
|
mOutputStream = socket.getOutputStream();
|
||||||
|
|
||||||
|
mCallbacks.onDaemonConnected();
|
||||||
|
|
||||||
byte[] buffer = new byte[BUFFER_SIZE];
|
byte[] buffer = new byte[BUFFER_SIZE];
|
||||||
int start = 0;
|
int start = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user