-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
Automatically close response stream once client connection closes #188
Conversation
src/Server.php
Outdated
// in particular this may only fire on a later read/write attempt | ||
// because we stop/pause reading from the connection once the | ||
// request has been processed. | ||
$connection->on('close', function() use ($stream) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well write this as $connection->on('close', [$stream, 'close']);
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the PR accordingly (have no strong opinion here) 👍
$socket->close(); | ||
} | ||
|
||
public function testStreamFromRequestHandlerWillBeClosedIfConnectionClosesWhileSendingBody() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed tests by increasing test timeouts
$socket->close(); | ||
} | ||
|
||
public function testStreamFromRequestHandlerWillBeClosedIfConnectionClosesButWillOnlyBeDetectedOnNextWrite() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test also fails: https://travis-ci.org/reactphp/http/jobs/235196355#L228
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed tests by increasing test timeouts
Builds on top of #187
This is also a prerequisite for upcoming changes related to #98