Merge branch 'jetty-10.0.x-3290-websocket-close' of https://github.com/lachlan-roberts/jetty.project into jetty-10.0.x-3290-websocket-close

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-02-07 14:17:25 +11:00
commit 3d096c9e99
3 changed files with 12 additions and 1 deletions

View File

@ -172,12 +172,14 @@ public class CloseStatus
return null;
}
// TODO consider defining a precedence for every CloseStatus, and change ChannelState only if higher precedence
public static boolean isOrdinary(CloseStatus closeStatus)
{
switch (closeStatus.getCode())
{
case NORMAL:
case SHUTDOWN:
case NO_CODE:
return true;
default:

View File

@ -65,6 +65,15 @@ public class FrameFlusher extends IteratingCallback
this.buffers = new ArrayList<>((maxGather * 2) + 1);
}
/**
* Enqueue a Frame to be written to the endpoint.
* @param frame The frame to queue
* @param callback The callback to call once the frame is sent
* @param batch True if batch mode is to be used
* @return returns true if the frame was enqueued and iterate needs to be called, returns false if the
* FrameFlusher was closed
*/
public boolean enqueue(Frame frame, Callback callback, boolean batch)
{
Entry entry = new Entry(frame, callback, batch);

View File

@ -344,7 +344,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
if (!fillingAndParsing)
throw new IllegalStateException();
if (demand != 0)
if (demand != 0) //if demand was canceled, this creates synthetic demand in order to read until EOF
return true;
fillingAndParsing = false;