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

Add SSLSocket#readbyte #771

Merged
merged 1 commit into from
Jul 3, 2024
Merged

Add SSLSocket#readbyte #771

merged 1 commit into from
Jul 3, 2024

Conversation

lwoggardner
Copy link
Contributor

Companion to getbyte but raise EOFError
Similar to #438

Companion to getbyte but raise EOFError
Similar to ruby#438
@rhenium rhenium merged commit c959729 into ruby:master Jul 3, 2024
54 checks passed
@rhenium
Copy link
Member

rhenium commented Jul 3, 2024

Looks good to me. Thank you for your PR!

@lwoggardner
Copy link
Contributor Author

Thanks @rhenium glad to help.

One question if I may.

My first inclination was to do

getbyte or raise EOFError

ie obvious that there is no way of getting a nil return if somehow EOF occurs between the eof? check and getbyte. This is also seems to be the approach used in the MRI C code for IO::readbyte.

But then I saw all the existing methods used this form...

raise EOFError if eof?
getbyte

I understand that this works because eof? has a side effect of pulling data into the buffer. My question is whether this was a concious choice for performance or some other reason? (and if not would you consider changing it?)

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

Successfully merging this pull request may close these issues.

2 participants