File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
protocol/src/main/java/org/threadly/litesockets/protocols/websocket Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,12 @@ public class WSFrame {
1717 private final int frameLength ;
1818
1919 protected WSFrame (final ByteBuffer bb ) {
20- frameLength = WSUtils .getFrameLength (bb );
20+ ByteBuffer sbb = bb .slice ();
21+ frameLength = WSUtils .getFrameLength (sbb );
2122 if (frameLength < 0 || bb .remaining () < frameLength ) {
2223 throw new IllegalStateException ("Not enough data to make a WebSocketFrame" );
2324 }
24- this .bb = bb ;
25+ this .bb = sbb ;
2526 }
2627
2728 /**
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ public static int getFrameLength(final ByteBuffer bb) {
148148 * @return the size in the first length field.
149149 */
150150 static byte getSmallLen (final ByteBuffer bb ) {
151- return (byte )(bb .get (1 ) & WSConstants .WS_SMALL_LENGTH_MASK );
151+ return (byte )(bb .get (bb . position ()+ 1 ) & WSConstants .WS_SMALL_LENGTH_MASK );
152152 }
153153
154154 static int getLengthSize (final ByteBuffer bb ) {
@@ -162,6 +162,6 @@ static int getLengthSize(final ByteBuffer bb) {
162162 }
163163
164164 private static boolean hasMask (final ByteBuffer bb ) {
165- return (bb .get (1 ) & WSConstants .UNSIGN_BYTE_MASK ) >> WSConstants .STATIC_SEVEN == 1 ;
165+ return (bb .get (bb . position ()+ 1 ) & WSConstants .UNSIGN_BYTE_MASK ) >> WSConstants .STATIC_SEVEN == 1 ;
166166 }
167167}
You can’t perform that action at this time.
0 commit comments