Skip to content

Commit 9a3838f

Browse files
committed
Make inputStreams clearing threadsafe
1 parent e19e65c commit 9a3838f

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

app/src/main/java/net/sharksystem/asap/android/lora/LoRaBTInputOutputStream.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,17 +268,19 @@ public int available() throws IOException {
268268
*/
269269
@Override
270270
public void close() {
271-
this.inputStreams.clear();
272271
this.shouldClose = true;
273272

274273
// Check if someone is currently reading.
275274
// If so, notify, else just assume we are closed
276-
if (this.isReading)
275+
if (this.isReading) {
277276
synchronized (this.threadLock) {
277+
this.inputStreams.clear();
278278
this.threadLock.notify();
279279
}
280-
else
280+
} else {
281+
this.inputStreams.clear();
281282
this.wasClosed = true;
283+
}
282284
}
283285

284286
/**

0 commit comments

Comments
 (0)