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

Fix tcp socket with connect timeout #57

Merged
merged 3 commits into from
Aug 9, 2024

Conversation

lizzypy
Copy link
Contributor

@lizzypy lizzypy commented Aug 8, 2024

This library doesn't fully work with Ruby versions > 3

The TCPSocket class in ruby 3.0.0 and up has an optional keyword argument to specify a connection timeout. Another library we were using was passing a connect_timeout to the TCPSocket initializer. Because this library monkey patches the initializer and then doesn't allow for additional keyword arguments the connect_timeout argument was getting turned into a hash and passed as the local_host argument which caused exceptions.

The test (without the code changes in tcpsocket replicates the errors it could cause.

This change allows for keyword arguments so that a connect_timeout can be passed.

@MatzFan MatzFan merged commit 5ee3fe0 into astro:master Aug 9, 2024
0 of 4 checks passed
@MatzFan
Copy link
Collaborator

MatzFan commented Aug 9, 2024

Awesome, many thanks @lizzypy

@lizzypy
Copy link
Contributor Author

lizzypy commented Aug 9, 2024

@MatzFan are you also able to make a new release with this fix? Then we can use the newest version in our app. Thanks!

@MatzFan
Copy link
Collaborator

MatzFan commented Aug 9, 2024

@lizzypy done. I'm the maintainer of the repo, not the owner. I'll ping @astro to ask for a push to rubygems.

@lizzypy
Copy link
Contributor Author

lizzypy commented Aug 9, 2024

@MatzFan Thank you!!

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.

2 participants