Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent semantics for DuplexStreamInterface::end() to ensure it SHOULD also end readable side #86

Merged
merged 2 commits into from
Mar 26, 2017

Conversation

clue
Copy link
Member

@clue clue commented Mar 24, 2017

The semantics for this are currently not explicit and the DuplexResourceStream (previously Stream) class has a very unclear end() logic implemented. It currently turns the stream into non-readable mode but keeps emitting readable events despite.

This PR ensures we use consistent semantics to ensure duplex streams SHOULD also end the readable side (unless this is a stream that supports half-open mode, see #27).

This should in fact not break any of the existing assumptions and as such should not be considered a BC break. Given that this current behavior was mostly underdocumented or undocumented, I'll mark this as a BC break just to be safe in case any implementation relies on undocumented features which might now be prohibited.

Builds on top of #72.

@clue clue added this to the v0.6.0 milestone Mar 24, 2017
Copy link
Member

@jsor jsor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor typo, LGTM otherwise.

README.md Outdated
@@ -629,6 +629,16 @@ $stream->write('nope'); // NO-OP
$stream->end(); // NO-OP
```

If this stream is a `DuplexStreamInterface`, calling this method SHOULD
also end its readable side, unless the stream supports half-open mode.
In other words, after calling this method, these stream SHOULD switch into
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the/this stream SHOULD

@@ -262,6 +262,16 @@ public function write($data);
* $stream->end(); // NO-OP
* ```
*
* If this stream is a `DuplexStreamInterface`, calling this method SHOULD
* also end its readable side, unless the stream supports half-open mode.
* In other words, after calling this method, these stream SHOULD switch into
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the/this stream

@clue
Copy link
Member Author

clue commented Mar 25, 2017

Thanks for spotting, typos fixed and squashed :shipit:

@jsor jsor merged commit dcc0c46 into reactphp:master Mar 26, 2017
@clue clue deleted the end branch March 26, 2017 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants