Skip to content

Commit 1903a73

Browse files
jason-simmonsAndroid (Google) Code Review
authored andcommitted
Merge "Avoid calling BluetoothSocket.destroyNative twice" into ics-aah
2 parents b89ce43 + 34b2feb commit 1903a73

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/java/android/bluetooth/BluetoothSocket.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,10 @@ public void close() throws IOException {
242242
// abortNative(), so this lock should immediately acquire
243243
mLock.writeLock().lock();
244244
try {
245-
mSocketState = SocketState.CLOSED;
246-
destroyNative();
245+
if (mSocketState != SocketState.CLOSED) {
246+
mSocketState = SocketState.CLOSED;
247+
destroyNative();
248+
}
247249
} finally {
248250
mLock.writeLock().unlock();
249251
}

0 commit comments

Comments
 (0)