mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/net/http.rb (finish): does not raise IOError even if !started?, to allow duplicated #finish call.
* lib/net/pop.rb (finish): ditto. * lib/net/smtp.rb (finish): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ccf1c21d3e
commit
819e8e6c82
4 changed files with 14 additions and 12 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Mon Sep 29 23:39:13 2003 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
|
* lib/net/http.rb (finish): does not raise IOError even if
|
||||||
|
!started?, to allow duplicated #finish call.
|
||||||
|
|
||||||
|
* lib/net/pop.rb (finish): ditto.
|
||||||
|
|
||||||
|
* lib/net/smtp.rb (finish): ditto.
|
||||||
|
|
||||||
Mon Sep 29 19:06:51 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
Mon Sep 29 19:06:51 2003 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
* ext/win32ole/extconf.rb: add windows.h checking.
|
* ext/win32ole/extconf.rb: add windows.h checking.
|
||||||
|
|
|
@ -416,7 +416,7 @@ module Net # :nodoc:
|
||||||
do_start
|
do_start
|
||||||
return yield(self)
|
return yield(self)
|
||||||
ensure
|
ensure
|
||||||
finish if @started
|
finish
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
do_start
|
do_start
|
||||||
|
@ -437,9 +437,7 @@ module Net # :nodoc:
|
||||||
private :on_connect
|
private :on_connect
|
||||||
|
|
||||||
# Finishes HTTP session and closes TCP connection.
|
# Finishes HTTP session and closes TCP connection.
|
||||||
# If HTTP session had not started, raises an IOError.
|
|
||||||
def finish
|
def finish
|
||||||
raise IOError, 'closing already closed HTTP session' unless @started
|
|
||||||
@socket.close if @socket and not @socket.closed?
|
@socket.close if @socket and not @socket.closed?
|
||||||
@socket = nil
|
@socket = nil
|
||||||
@started = false
|
@started = false
|
||||||
|
|
|
@ -415,7 +415,7 @@ module Net
|
||||||
do_start account, password
|
do_start account, password
|
||||||
return yield(self)
|
return yield(self)
|
||||||
ensure
|
ensure
|
||||||
finish if @started
|
finish
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
do_start account, password
|
do_start account, password
|
||||||
|
@ -441,10 +441,8 @@ module Net
|
||||||
end
|
end
|
||||||
private :on_connect
|
private :on_connect
|
||||||
|
|
||||||
# Finishes a POP3 session.
|
# Finishes a POP3 session and closes TCP connection.
|
||||||
# If a POP3 session has not been started, raises an IOError.
|
|
||||||
def finish
|
def finish
|
||||||
raise IOError, 'already closed POP session' unless @started
|
|
||||||
@mails = nil
|
@mails = nil
|
||||||
@command.quit if @command
|
@command.quit if @command
|
||||||
@command = nil
|
@command = nil
|
||||||
|
|
|
@ -331,7 +331,7 @@ module Net # :nodoc:
|
||||||
do_start(helo, user, secret, authtype)
|
do_start(helo, user, secret, authtype)
|
||||||
return yield(self)
|
return yield(self)
|
||||||
ensure
|
ensure
|
||||||
finish if @started
|
finish
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
do_start(helo, user, secret, authtype)
|
do_start(helo, user, secret, authtype)
|
||||||
|
@ -365,11 +365,8 @@ module Net # :nodoc:
|
||||||
end
|
end
|
||||||
private :do_start
|
private :do_start
|
||||||
|
|
||||||
# Finish (close) the SMTP session.
|
# Finishes the SMTP session and closes TCP connection.
|
||||||
#
|
|
||||||
# If the SMTP session has not been started, an IOError is raised.
|
|
||||||
def finish
|
def finish
|
||||||
raise IOError, 'closing already closed SMTP session' unless @started
|
|
||||||
quit if @socket and not @socket.closed? and not @error_occured
|
quit if @socket and not @socket.closed? and not @error_occured
|
||||||
@socket.close if @socket and not @socket.closed?
|
@socket.close if @socket and not @socket.closed?
|
||||||
@socket = nil
|
@socket = nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue