Skip to content

Commit 8ef67b4

Browse files
committed
fixed an other bug in the handshake ( TooTallNate#91 and TooTallNate#94)
1 parent 08a7b34 commit 8ef67b4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/org/java_websocket/WebSocketImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ private boolean decodeHandshake( ByteBuffer socketBufferNew ) throws IOException
207207
tmpHandshakeBytes.flip();
208208
socketBuffer = tmpHandshakeBytes;
209209
}
210+
socketBuffer.mark();
210211
try {
211212
if( draft == null ) {
212213
HandshakeState isflashedgecase = isFlashEdgeCase( socketBuffer );
@@ -217,7 +218,7 @@ private boolean decodeHandshake( ByteBuffer socketBufferNew ) throws IOException
217218
}
218219
}
219220
HandshakeState handshakestate = null;
220-
socketBuffer.mark();
221+
221222
try {
222223
if( role == Role.SERVER ) {
223224
if( draft == null ) {
@@ -298,6 +299,7 @@ private boolean decodeHandshake( ByteBuffer socketBufferNew ) throws IOException
298299
}
299300
} catch ( IncompleteHandshakeException e ) {
300301
if( tmpHandshakeBytes == null ) {
302+
socketBuffer.reset();
301303
int newsize = e.getPreferedSize();
302304
if( newsize == 0 ) {
303305
newsize = socketBuffer.capacity() + 16;

0 commit comments

Comments
 (0)