summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/isode/stroke/network/JavaConnection.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/com/isode/stroke/network/JavaConnection.java b/src/com/isode/stroke/network/JavaConnection.java
index 66f068f..db748e8 100644
--- a/src/com/isode/stroke/network/JavaConnection.java
+++ b/src/com/isode/stroke/network/JavaConnection.java
@@ -49,7 +49,7 @@ public class JavaConnection extends Connection implements EventOwner {
private final HostAddressPort address_;
private final List<byte[]> writeBuffer_ = Collections.synchronizedList(new ArrayList<byte[]>());
- private SelectionKey selectionKey_;
+ private volatile SelectionKey selectionKey_;
private boolean disconnected_ = false;
public Worker(HostAddressPort address) {
@@ -311,7 +311,9 @@ public class JavaConnection extends Connection implements EventOwner {
// https://code.google.com/p/android/issues/detail?id=80785
if (synchroniseReads_ && selector_ != null) {
synchronized (selectorLock_) {
- selectionKey_.interestOps(SelectionKey.OP_READ);
+ if (selectionKey_.isValid()) {
+ selectionKey_.interestOps(SelectionKey.OP_READ);
+ }
if (selector_.isOpen()) {
selector_.wakeup();
}