Skip to content

Commit bd9dbfd

Browse files
NathanielMichaelTooTallNate
authored andcommitted
Fixed an issue with WebSocketServer that was causing a CancelledKeyException to be thrown when a client disconnected.
1 parent 30d48f1 commit bd9dbfd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/net/tootallnate/websocket/WebSocketServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ public void run() {
218218

219219
// if isWritable == true
220220
// then we need to send the rest of the data to the client
221-
if (key.isWritable()) {
221+
if (key.isValid() && key.isWritable()) {
222222
WebSocket conn = (WebSocket)key.attachment();
223223
if (conn.handleWrite()) {
224224
conn.socketChannel().register(selector,

0 commit comments

Comments
 (0)