Skip to content

Commit d74858c

Browse files
committed
thanks @jw-gadgetworks for pointing this error out!! (TooTallNate#147)
1 parent 47256b1 commit d74858c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/java/org/java_websocket/server/WebSocketServer.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,14 @@ public void run() {
359359
conn = iqueue.remove( 0 );
360360
WrappedByteChannel c = ( (WrappedByteChannel) conn.channel );
361361
ByteBuffer buf = takeBuffer();
362-
if( SocketChannelIOHelper.readMore( buf, conn, c ) )
363-
iqueue.add( conn );
364-
conn.inQueue.put( buf );
365-
queue( conn );
362+
try {
363+
if( SocketChannelIOHelper.readMore( buf, conn, c ) )
364+
iqueue.add( conn );
365+
conn.inQueue.put( buf );
366+
queue( conn );
367+
} finally {
368+
pushBuffer( buf );
369+
}
366370

367371
}
368372
} catch ( CancelledKeyException e ) {
@@ -381,7 +385,6 @@ public void run() {
381385
handleFatal( null, e );
382386
}
383387
}
384-
385388
protected void allocateBuffers( WebSocket c ) throws InterruptedException {
386389
if( queuesize.get() >= 2 * decoders.size() + 1 ) {
387390
return;

0 commit comments

Comments
 (0)