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

Calculate stream timeout correctly #135

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

timsmid
Copy link

@timsmid timsmid commented Jan 12, 2019

This PR improves the way the stream timeout is handled. More specifically:

  • The timeout is only set once during the creation of the stream. This is done through the setStreamTimeout method once the stream has been created.
  • The unnecessary try-catch block in setStreamTimeout is removed.
  • The number_format call for calculating the stream timeout is error-prone. It is replaced with int-casting and a call to round.
  • The stream_set_timeout emits a warning when float values are provided instead of ints. This solution ensures only ints are provided. The current solution and PR Fixes #129 Adding optional params to number_format #132 don't fully account for this situation.
  • Strange timeout values are denied. This for example includes negative values and values greater than PHP_INT_MAX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant