diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java index 48a57003c60..211c50c9668 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/FrameFlusher.java @@ -18,6 +18,7 @@ package org.eclipse.jetty.websocket.core.internal; +import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayDeque; import java.util.ArrayList; @@ -74,6 +75,18 @@ public class FrameFlusher extends IteratingCallback } } + public void onClose() + { + Throwable cause = null; + synchronized (this) + { + if (!queue.isEmpty()) + cause = new IOException("Closed"); + } + if (cause!=null) + onCompleteFailure(cause); + } + @Override protected Action process() throws Throwable { diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java index 7b602106047..cdd40ed3e8a 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java @@ -172,10 +172,12 @@ public class WebSocketConnection extends AbstractConnection implements Connectio IOException e = new IOException("Closed"); channel.onClosed(e); } + flusher.onClose(); super.onClose(); } + @Override public boolean onIdleExpired() {