File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -544,12 +544,22 @@ public void startHandshake( ClientHandshakeBuilder handshakedata ) throws Invali
544544 private void channelWrite ( ByteBuffer buf ) throws InterruptedException {
545545 if ( DEBUG )
546546 System .out .println ( "write(" + buf .limit () + "): {" + ( buf .limit () > 1000 ? "too big to display" : new String ( buf .array () ) ) + "}" );
547- buf .rewind ();
547+ buf .rewind (); // TODO rewinding should not be nessesary
548548 synchronized (bufferQueueTotalAmount ) {
549549 // add up the number of bytes to the total queued (synchronized over this object)
550550 bufferQueueTotalAmount += buf .limit ();
551551 }
552- bufferQueue .put ( buf );
552+ if ( !bufferQueue .offer ( buf ) ) {
553+ try {
554+ flush ();
555+ } catch ( IOException e ) {
556+ wsl .onWebsocketError ( this , e );
557+ closeConnection ( CloseFrame .ABNROMAL_CLOSE , true );
558+ return ;
559+ }
560+ bufferQueue .put ( buf );
561+ }
562+
553563 wsl .onWriteDemand ( this );
554564 }
555565
You can’t perform that action at this time.
0 commit comments