Skip to content

Fix connection leak when the thread is interrupted by Thread#kill etc.#27

Merged
shugo merged 1 commit into
masterfrom
fix-connection-leak-when-thread-interrupted
Dec 15, 2023
Merged

Fix connection leak when the thread is interrupted by Thread#kill etc.#27
shugo merged 1 commit into
masterfrom
fix-connection-leak-when-thread-interrupted

Conversation

@shugo

@shugo shugo commented Dec 15, 2023

Copy link
Copy Markdown
Member

Suggested by @ioquatix in #24 (comment)

@jeremyevans jeremyevans left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread lib/net/ftp.rb
def transfercmd(cmd, rest_offset = nil) # :nodoc:
if @passive
host, port = makepasv
succeeded = false

Copy link
Copy Markdown
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
Copy Markdown
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.

@ioquatix ioquatix left a comment

Copy link
Copy Markdown
Member

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
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants