Issue #3290 - review changes, javadoc and todos

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2019-02-07 14:09:23 +11:00
parent 1709c90286
commit c86bf2e57f
3 changed files with 12 additions and 1 deletions

View File

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

View File

@ -64,6 +64,15 @@ public class FrameFlusher extends IteratingCallback
this.buffers = new ArrayList<>((maxGather * 2) + 1); 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) public boolean enqueue(Frame frame, Callback callback, boolean batch)
{ {
Entry entry = new Entry(frame, callback, batch); Entry entry = new Entry(frame, callback, batch);

View File

@ -348,7 +348,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
if (!fillingAndParsing) if (!fillingAndParsing)
throw new IllegalStateException(); 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; return true;
fillingAndParsing = false; fillingAndParsing = false;