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

Fixed socket non-blocking read leaking to next receive call #111

Closed jakubkulhan closed 6 years ago

jakubkulhan commented 6 years ago

If there are buffered unread bytes, socket is switched to non-blocking mode (stream_set_blocking($this->socket, false)). However, next receive()s will return empty buffer if there are no data to be read, because socket remains on non-blocking mode. This fix switches socket back to blocking mode after next read.