Issue #3666 - changes from review

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2019-06-03 11:18:41 +10:00
parent e5a6910be4
commit 6681da7e74
2 changed files with 5 additions and 12 deletions

View File

@ -176,10 +176,7 @@ public class CloseStatus
public static boolean isOrdinary(CloseStatus closeStatus)
{
int code = closeStatus.getCode();
if (code == NORMAL || code == NO_CODE || code >= 3000)
return true;
else
return false;
return (code == NORMAL || code == NO_CODE || code >= 3000);
}
public int getCode()

View File

@ -114,16 +114,13 @@ public class FrameFlusher extends IteratingCallback
{
case OpCode.CLOSE:
closeStatus = CloseStatus.getCloseStatus(frame);
if (CloseStatus.isOrdinary(closeStatus))
queue.offerLast(entry);
else
if (!CloseStatus.isOrdinary(closeStatus))
{
//fail all existing entries in the queue, and enqueue the close frame
//fail all existing entries in the queue, and enqueue the error close
failedEntries = new ArrayList<>(queue);
queue.clear();
queue.offerFirst(entry);
}
queue.offerLast(entry);
this.canEnqueue = false;
break;
@ -157,8 +154,7 @@ public class FrameFlusher extends IteratingCallback
if (closeStatus instanceof AbnormalCloseStatus)
{
Throwable cause = ((AbnormalCloseStatus)closeStatus).getCause();
if (cause != null)
failure.addSuppressed(cause);
failure.initCause(cause);
}
for (Entry e : failedEntries)