Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Oct 1, 2013
1 parent 9a95e24 commit a37758e
Showing 1 changed file with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -447,23 +447,27 @@ public void close(WebSocket webSocket, int closeCode) {
webSocketHandler.onClose(webSocket);
}

AsynchronousProcessor.AsynchronousProcessorHook h = (AsynchronousProcessor.AsynchronousProcessorHook)
r.getAttribute(ASYNCHRONOUS_HOOK);
if (!resource.isCancelled() && h != null) {
if (closeCode == 1005) {
h.closed();
} else {
h.timedOut();
}
Object o = r.getAttribute(ASYNCHRONOUS_HOOK);
AsynchronousProcessor.AsynchronousProcessorHook h;
if (o != null && AsynchronousProcessor.class.isAssignableFrom(o.getClass())) {
h = (AsynchronousProcessor.AsynchronousProcessorHook)
r.getAttribute(ASYNCHRONOUS_HOOK);
if (!resource.isCancelled()) {
if (closeCode == 1005) {
h.closed();
} else {
h.timedOut();
}

resource.setIsInScope(false);
try {
resource.cancel();
} catch (IOException e) {
logger.trace("", e);
resource.setIsInScope(false);
try {
resource.cancel();
} catch (IOException e) {
logger.trace("", e);
}
}
AtmosphereResourceImpl.class.cast(resource)._destroy();
}
AtmosphereResourceImpl.class.cast(resource)._destroy();
}

} finally {
Expand Down

0 comments on commit a37758e

Please sign in to comment.