Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make sure a selector isn't canceled before reading it

If a selector is canceled then isReadable will throw an exception.
To avoid this exception and do the right thing make sure that the
selector is valid before checking if it is readable.

Change-Id: If3f9542e371eaeddf2bdea05b14b6d7263803e6a
Reviewed-on: http://review.couchbase.org/6920
Tested-by: Michael Wiederhold <mike@couchbase.com>
Reviewed-by: Matt Ingenthron <matt@couchbase.com>
  • Loading branch information...
commit 0e5c16c3e79d21beefda0cef6601022866943845 1 parent f552ef9
Mike Wiederhold mikewied authored mikewied committed
4 src/main/java/net/spy/memcached/MemcachedConnection.java
@@ -421,10 +421,10 @@ private void handleIO(SelectionKey sk) {
421 421 assert !channel.isConnected() : "connected";
422 422 }
423 423 } else {
424   - if(sk.isReadable()) {
  424 + if(sk.isValid() && sk.isReadable()) {
425 425 handleReads(sk, qa);
426 426 }
427   - if(sk.isWritable()) {
  427 + if(sk.isValid() && sk.isWritable()) {
428 428 handleWrites(sk, qa);
429 429 }
430 430 }

0 comments on commit 0e5c16c

Please sign in to comment.
Something went wrong with that request. Please try again.