-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: connect methods' block behavior #505
feat: connect methods' block behavior #505
Conversation
0fc8bdb
to
fa0cf83
Compare
- return the block's return value - TCP/UDP: close the socket even if the block raises an exception
fa0cf83
to
34fea0c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- While I generally agree that the connection should be closed on exception, do you think there might be value in leaving it open for debugging purposes, such as if you used
ruby-debug
orpry
? - Would you consider this more of a bug fix or an enhancement/feature? If it's a change in behavior or new feature, then you should rebase against the
1.1.0
branch. If it's more of a bug fix, then branching off ofmain
is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might also want to add this logic to the other lib/ronin/support/network/*/mixin.rb
files which define methods that will close a connection if a block is given:
lib/ronin/support/network/pop3/mixin.rb
lib/ronin/support/network/smtp/mixin.rb
I don't personally see the value in leaving it open for potential debugging purposes, since a) developers can still set a breakpoint inside the block, and b) it risks a resource leak, especially if anybody is calling
🤔 Well, I think the "return the block's value" is a feature, but closing the connection is a bugfix. If your primary concern in asking is "should this go out in the imminent 1.1.0 release or can it wait for the next minor release" I think they can both probably wait.
OK! I will add them to this PR today. Edit: Done! |
- return the block's return value - close the socket even if the block raises an exception
I guess we could argue that this is a bug fix since we are correcting the behavior to be the "correct" behavior. I can squash merge this and queue it up for the next patch release. |
For the methods
TCP.connect
,UDP.connect
,HTTP.connect
,POP3::Mixin#pop3_connect
, andSMTP::Mixin#smtp_connect
: