File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,11 +21,16 @@ class Buffer extends EventEmitter implements WritableStreamInterface
2121 'file ' => '' ,
2222 'line ' => 0 ,
2323 );
24+ private $ meta ;
2425
2526 public function __construct ($ stream , LoopInterface $ loop )
2627 {
2728 $ this ->stream = $ stream ;
2829 $ this ->loop = $ loop ;
30+
31+ if (is_resource ($ stream )) {
32+ $ this ->meta = stream_get_meta_data ($ stream );
33+ }
2934 }
3035
3136 public function isWritable ()
@@ -78,7 +83,7 @@ public function close()
7883
7984 public function handleWrite ()
8085 {
81- if (!is_resource ($ this ->stream ) || feof ($ this ->stream )) {
86+ if (!is_resource ($ this ->stream ) || ( ' generic_socket ' === $ this -> meta [ ' stream_type ' ] && feof ($ this ->stream ) )) {
8287 $ this ->emit ('error ' , array (new \RuntimeException ('Tried to write to closed or invalid stream. ' )));
8388
8489 return ;
You can’t perform that action at this time.
0 commit comments