File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,16 @@ public function __construct($stream, LoopInterface $loop)
2424 }
2525
2626 stream_set_blocking ($ this ->stream , 0 );
27- stream_set_read_buffer ($ this ->stream , 0 );
27+
28+ // Use unbuffered read operations on the underlying stream resource.
29+ // Reading chunks from the stream may otherwise leave unread bytes in
30+ // PHP's stream buffers which some event loop implementations do not
31+ // trigger events on (edge triggered).
32+ // This does not affect the default event loop implementation (level
33+ // triggered), so we can ignore platforms not supporting this (HHVM).
34+ if (function_exists ('stream_set_read_buffer ' )) {
35+ stream_set_read_buffer ($ this ->stream , 0 );
36+ }
2837
2938 $ this ->loop = $ loop ;
3039 $ this ->buffer = new Buffer ($ this ->stream , $ this ->loop );
You can’t perform that action at this time.
0 commit comments