Merge "Close the base socket when bindListen fails" into lmp-dev

This commit is contained in:
Matthew Xie
2014-09-03 19:29:02 +00:00
committed by Android (Google) Code Review

View File

@@ -375,6 +375,14 @@ public final class BluetoothSocket implements Closeable {
} // else ASSERT(mPort == channel)
ret = 0;
} catch (IOException e) {
if (mPfd != null) {
try {
mPfd.close();
} catch (IOException e1) {
Log.e(TAG, "bindListen, close mPfd: " + e1);
}
mPfd = null;
}
Log.e(TAG, "bindListen, fail to get port number, exception: " + e);
return -1;
}