forked from ruby/net-smtp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract public quit!/disconnect from do_finish
This renames `#do_finish` to `#quit!`, makes it public, adds an option to convert exceptions into warnings, and extracts the contents of the ensure block into a new public `#disconnect` method. The motivation for making these public is given in the rdoc. As documented in the rdoc, `#quit!`: > Calls #quit and ensures that #disconnect is called. Returns the > result from #quit. Returns +nil+ when the client is already > disconnected or when a prior error prevents the client from calling > #quit. Unlike #finish, this an exception will not be raised when the > client has not started. > > If #quit raises a StandardError, the connection is dropped and the > exception is re-raised. When <tt>exception: :warn</tt> is specified, > a warning is printed and the exception is returned. When <tt>warning: > false</tt>, the warning is not printed. This is useful when the > connection must be dropped, for example in a test suite or due to > security concerns. As documented in the rdoc, `#disconnect`: > Disconnects the socket without checking if the connection has started > yet, and without sending a final QUIT message to the server. > > Generally, either #finish or #quit! should be used instead.
- Loading branch information
Showing
2 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters