am 9c38a6dc: am e87ebb08: Merge "Cleanup Netd to prevent getting hung." into gingerbread

Merge commit '9c38a6dc13ba55fccb9c66f347307a1b4ae68105'

* commit '9c38a6dc13ba55fccb9c66f347307a1b4ae68105':
  Cleanup Netd to prevent getting hung.
This commit is contained in:
Robert Greenwalt
2010-09-23 09:40:20 -07:00
committed by Android Git Automerger
3 changed files with 34 additions and 8 deletions

View File

@@ -181,7 +181,8 @@ final class NativeDaemonConnector implements Runnable {
}
}
private void sendCommand(String command) {
private void sendCommand(String command)
throws NativeDaemonConnectorException {
sendCommand(command, null);
}
@@ -191,11 +192,13 @@ final class NativeDaemonConnector implements Runnable {
* @param command The command to send to the daemon
* @param argument The argument to send with the command (or null)
*/
private void sendCommand(String command, String argument) {
private void sendCommand(String command, String argument)
throws NativeDaemonConnectorException {
synchronized (this) {
if (LOCAL_LOGD) Slog.d(TAG, String.format("SND -> {%s} {%s}", command, argument));
if (mOutputStream == null) {
Slog.e(TAG, "No connection to daemon", new IllegalStateException());
throw new NativeDaemonConnectorException("No output stream!");
} else {
StringBuilder builder = new StringBuilder(command);
if (argument != null) {
@@ -226,6 +229,7 @@ final class NativeDaemonConnector implements Runnable {
while (!complete) {
try {
// TODO - this should not block forever
String line = mResponseQueue.take();
if (LOCAL_LOGD) Slog.d(TAG, String.format("RSP <- {%s}", line));
String[] tokens = line.split(" ");