Skip to content

Commit

Permalink
Fixes #1087 , Fixes #818
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed May 14, 2013
1 parent 2c00895 commit 1ea78ba
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -438,20 +438,17 @@ public void close(WebSocket webSocket, int closeCode) {
} else if (webSocketHandler == null) {
logger.warn("AsynchronousProcessor.AsynchronousProcessorHook was null");
}
}

// We must always destroy the root resource (the one created when the websocket was opened
// to prevent memory leaks.
if (resource.isInScope()) {
resource.setIsInScope(false);
try {
resource.cancel();
} catch (IOException e) {
logger.trace("", e);
}
AtmosphereResourceImpl.class.cast(resource)._destroy();
}
AtmosphereResourceImpl.class.cast(resource)._destroy();
}

} finally {
if (r != null) {
r.destroy(true);
Expand Down Expand Up @@ -494,6 +491,7 @@ public void notifyListener(WebSocket webSocket, WebSocketEventListener.WebSocket
AtmosphereResourceImpl r = AtmosphereResourceImpl.class.cast(resource);

for (AtmosphereResourceEventListener l : r.atmosphereResourceEventListener()) {
r.notifyListeners(new AtmosphereResourceEventImpl(AtmosphereResourceImpl.class.cast(r), false, false, true, null));
if (WebSocketEventListener.class.isAssignableFrom(l.getClass())) {
try {
switch (event.type()) {
Expand Down

0 comments on commit 1ea78ba

Please sign in to comment.