Skip to content
Browse files

fixed an other bug in the handshake ( #91 and #94)

  • Loading branch information...
1 parent 08a7b34 commit 8ef67b46ecc927d5521849dcc2d85d10f9789c20 @Davidiusdadi Davidiusdadi committed May 22, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/org/java_websocket/WebSocketImpl.java
View
4 src/org/java_websocket/WebSocketImpl.java
@@ -207,6 +207,7 @@ private boolean decodeHandshake( ByteBuffer socketBufferNew ) throws IOException
tmpHandshakeBytes.flip();
socketBuffer = tmpHandshakeBytes;
}
+ socketBuffer.mark();
try {
if( draft == null ) {
HandshakeState isflashedgecase = isFlashEdgeCase( socketBuffer );
@@ -217,7 +218,7 @@ private boolean decodeHandshake( ByteBuffer socketBufferNew ) throws IOException
}
}
HandshakeState handshakestate = null;
- socketBuffer.mark();
+
try {
if( role == Role.SERVER ) {
if( draft == null ) {
@@ -298,6 +299,7 @@ private boolean decodeHandshake( ByteBuffer socketBufferNew ) throws IOException
}
} catch ( IncompleteHandshakeException e ) {
if( tmpHandshakeBytes == null ) {
+ socketBuffer.reset();
int newsize = e.getPreferedSize();
if( newsize == 0 ) {
newsize = socketBuffer.capacity() + 16;

0 comments on commit 8ef67b4

Please sign in to comment.
Something went wrong with that request. Please try again.