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 connection leak when the thread is interrupted by Thread#kill etc. #27

Merged
merged 1 commit into from Dec 15, 2023

Conversation

shugo
Copy link
Member

@shugo shugo commented Dec 15, 2023

Suggested by @ioquatix in #24 (comment)

Copy link
Contributor

@jeremyevans jeremyevans left a comment

Choose a reason for hiding this comment

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

I reviewed the related code, and it doesn't yield or appear to pass control to user code, so non-local flow control should not be a consideration, and this approach should be fine.

@@ -563,6 +563,7 @@ def makepasv # :nodoc:
def transfercmd(cmd, rest_offset = nil) # :nodoc:
if @passive
host, port = makepasv
succeeded = false
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is not actually needed. However, I have no problem with it if you using it to be explicit.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for your comment.

I'd like to initialize succeeded to clarify the intention.

Copy link
Member

@ioquatix ioquatix left a comment

Choose a reason for hiding this comment

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

LGTM. It's interesting that a trivial fix was actually non-trivial.

@shugo shugo merged commit 6be2f7e into master Dec 15, 2023
20 checks passed
@shugo shugo deleted the fix-connection-leak-when-thread-interrupted branch December 15, 2023 03:47
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.

None yet

3 participants