Open nowgoing opened 4 years ago
Can you write UT to show that problem exists? Because it looks like state isn't changed from WebSocketReadState::Payload
, when remaining_length is different than 0. So it looks like staying in mentioned state up to point, when length equals 0.
When remaininglength != 0 , websocket will stop reading.
But it's weird that moment earlier same amount of data are read at once.
So async_read_some() is not guaranteed to read the message data;The above problem occurs when binary audio data is transmitted using WebSocket, with 25 packets per second。
That's true. But you can only add else block, without assigning state_
variable.
Thanks! I've merged it to my fork :)
Reason for update:
When state_ == WebSocketReadState::Payload, The function async_read_some() is not guaranteed to read all the data. When remaininglength != 0 , you need to continue reading.