From ba06103442f221f1a1e680f25a3de1f91b157683 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 2 Nov 2012 10:28:23 +1100 Subject: [PATCH] 393383 delay onClose call until closeOut is done --- .../jetty/websocket/WebSocketConnectionRFC6455.java | 10 +++++----- .../jetty/websocket/WebSocketMessageRFC6455Test.java | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java index 46c1cbc6a74..d999d924fec 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketConnectionRFC6455.java @@ -323,13 +323,13 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We try { - if (tell_app) - _webSocket.onClose(code,message); + if (!closed_out) + closeOut(code,message); } finally { - if (!closed_out) - closeOut(code,message); + if (tell_app) + _webSocket.onClose(code,message); } } @@ -353,7 +353,7 @@ public class WebSocketConnectionRFC6455 extends AbstractConnection implements We } try - { + { if (tell_app) _webSocket.onClose(code,message); } diff --git a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java index 2e1846fde2d..048de59e078 100644 --- a/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java +++ b/jetty-websocket/src/test/java/org/eclipse/jetty/websocket/WebSocketMessageRFC6455Test.java @@ -1337,7 +1337,7 @@ public class WebSocketMessageRFC6455Test output.flush(); // Make sure the read times out if there are problems with the implementation - socket.setSoTimeout(1000); + socket.setSoTimeout(10000); InputStream input = socket.getInputStream(); @@ -1347,7 +1347,7 @@ public class WebSocketMessageRFC6455Test skipTo("\r\n\r\n",input); - assertTrue(__serverWebSocket.awaitConnected(1000)); + assertTrue(__serverWebSocket.awaitConnected(10000)); assertNotNull(__serverWebSocket.connection); assertEquals(0x81,input.read()); @@ -1355,7 +1355,7 @@ public class WebSocketMessageRFC6455Test lookFor("sent on connect",input); socket.close(); - assertTrue(__serverWebSocket.awaitDisconnected(500)); + assertTrue(__serverWebSocket.awaitDisconnected(10000)); try {