varspool / Wrench

A simple PHP WebSocket implementation for PHP 7.1
Do What The F*ck You Want To Public License
596 stars 210 forks source link

unblocking read from socket when it the queue is empty #82

Closed Alarmfifa closed 7 years ago

Alarmfifa commented 8 years ago

If we send a message more then DEFAULT_RECEIVE_LENGTH server hangs on the second attempt to read

Alarmfifa commented 8 years ago

Added a second commit.

If we receive a message with length equal DEFAULT_RECEIVE_LENGTH here: https://github.com/varspool/Wrench/blob/master/lib/Wrench/Socket/Socket.php#L314-L316 we try to re-read socket one more time. But it is wrong. If $metadata['unread_bytes'] == false just stop reading.