diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 018289ac7..b425b6e5d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ strict IP policy. Please also read [this](http://wiki.eclipse.org/Development_Resources/Contributing_via_Git) -In order for any contributions to be accepted you MUST do the following things: +In order for any contributions to be accepted you MUST do the following things. * Sign the [Eclipse Foundation Contributor License Agreement](http://www.eclipse.org/legal/CLA.php). To sign the Eclipse CLA you need to: @@ -19,6 +19,8 @@ If you don’t, you need to [register](https://dev.eclipse.org/site_login/create * Login into the [projects portal](https://projects.eclipse.org/), select “My Account”, and then the “Contributor License Agreement” tab. +* Add your github username in your Eclipse Foundation account settings. Log in it to Eclipse and go to account settings. + * "Sign-off" your commits Every commit you make in your patch or pull request MUST be "signed off". diff --git a/vertx-core/src/main/java/org/vertx/java/core/sockjs/EventBusBridge.java b/vertx-core/src/main/java/org/vertx/java/core/sockjs/EventBusBridge.java index 9a45b19aa..c7cba8d5b 100644 --- a/vertx-core/src/main/java/org/vertx/java/core/sockjs/EventBusBridge.java +++ b/vertx-core/src/main/java/org/vertx/java/core/sockjs/EventBusBridge.java @@ -195,6 +195,10 @@ public class EventBusBridge implements Handler { return; } final SockInfo info = sockInfos.get(sock); + if (info == null) { + // Connection already closed + return; + } if (!checkMaxHandlers(info)) { return; } @@ -243,6 +247,10 @@ public class EventBusBridge implements Handler { if (handler != null) { eb.unregisterHandler(address, handler); SockInfo info = sockInfos.get(sock); + if (info == null) { + // Connection already closed + return; + } info.handlerCount--; } } @@ -263,6 +271,8 @@ public class EventBusBridge implements Handler { sock.endHandler(new VoidHandler() { public void handle() { + System.out.println("In handlesocketclosed"); + new Exception().printStackTrace(); handleSocketClosed(sock, handlers); } }); @@ -395,6 +405,10 @@ public class EventBusBridge implements Handler { final SockJSSocket sock, final String replyAddress) { final SockInfo info = sockInfos.get(sock); + if (info == null) { + // Connection already closed + return; + } if (replyAddress != null && !checkMaxHandlers(info)) { return; } @@ -527,6 +541,10 @@ public class EventBusBridge implements Handler { private void cacheAuthorisation(String sessionID, SockJSSocket sock) { authCache.put(sessionID, new Auth(sessionID, sock)); SockInfo sockInfo = sockInfos.get(sock); + if (sockInfo == null) { + // Connection already closed + return; + } Set sess = sockInfo.sockAuths; if (sess == null) { sess = new HashSet<>(); @@ -538,6 +556,10 @@ public class EventBusBridge implements Handler { private void uncacheAuthorisation(String sessionID, SockJSSocket sock) { authCache.remove(sessionID); SockInfo sockInfo = sockInfos.get(sock); + if (sockInfo == null) { + // Connection already closed + return; + } Set sess = sockInfo.sockAuths; if (sess != null) { sess.remove(sessionID); diff --git a/vertx-core/src/main/java/org/vertx/java/core/sockjs/impl/BaseTransport.java b/vertx-core/src/main/java/org/vertx/java/core/sockjs/impl/BaseTransport.java index 600ed75c1..89ee23fd9 100644 --- a/vertx-core/src/main/java/org/vertx/java/core/sockjs/impl/BaseTransport.java +++ b/vertx-core/src/main/java/org/vertx/java/core/sockjs/impl/BaseTransport.java @@ -87,7 +87,7 @@ class BaseTransport { resp.closeHandler(new VoidHandler() { public void handle() { if (log.isTraceEnabled()) log.trace("Connection closed (from client?), closing session"); - // Connection has been closed fron the client or network error so + // Connection has been closed from the client or network error so // we remove the session session.shutdown(); close(); diff --git a/vertx-core/src/main/java/org/vertx/java/core/sockjs/impl/Session.java b/vertx-core/src/main/java/org/vertx/java/core/sockjs/impl/Session.java index 2d9c8024d..a7a719083 100644 --- a/vertx-core/src/main/java/org/vertx/java/core/sockjs/impl/Session.java +++ b/vertx-core/src/main/java/org/vertx/java/core/sockjs/impl/Session.java @@ -281,6 +281,7 @@ class Session extends SockJSSocketBase implements Shareable { // Actually close the session - when the user calls close() the session actually continues to exist until timeout // Yes, I know it's weird but that's the way SockJS likes it. private void doClose() { + System.out.println(("**** do close called !!")); super.close(); // We must call this or handlers don't get unregistered and we get a leak if (heartbeatID != -1) { vertx.cancelTimer(heartbeatID); @@ -290,6 +291,7 @@ class Session extends SockJSSocketBase implements Shareable { } if (id != null) { // Can be null if websocket session + System.out.println(("**** removing session!!")); sessions.remove(id); }