File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/net/tootallnate/websocket Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ public final class WebSocket {
8686 * the proper order.
8787 */
8888 private Object bufferQueueMutex = new Object ();
89+
90+ private boolean readingState = false ;
8991
9092
9193 // CONSTRUCTOR /////////////////////////////////////////////////////////////
@@ -212,10 +214,12 @@ public SocketChannel socketChannel() {
212214 private void recieveFrame () {
213215 byte newestByte = this .buffer .get ();
214216
215- if (newestByte == START_OF_FRAME ) { // Beginning of Frame
217+ if (newestByte == START_OF_FRAME && ! readingState ) { // Beginning of Frame
216218 this .currentFrame = null ;
219+ readingState = true ;
217220
218- } else if (newestByte == END_OF_FRAME ) { // End of Frame
221+ } else if (newestByte == END_OF_FRAME && readingState ) { // End of Frame
222+ readingState = false ;
219223 String textFrame = null ;
220224 // currentFrame will be null if END_OF_FRAME was send directly after
221225 // START_OF_FRAME, thus we will send 'null' as the sent message.
You can’t perform that action at this time.
0 commit comments