diff options
author | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-29 18:12:20 +0000 |
---|---|---|
committer | aamine <aamine@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-09-29 18:12:20 +0000 |
commit | e377a12bff690512a568b93c018ec42961ac2a48 (patch) | |
tree | c8f8eaddf4a3869a297307b1c8374a0d5f29023e /lib/net/pop.rb | |
parent | 2eeb39b3cf1b069f309126daed5cbec67ea3f616 (diff) | |
download | ruby-e377a12bff690512a568b93c018ec42961ac2a48.tar.gz |
* lib/net/http.rb (finish): revert to 1.93.
* lib/net/pop.rb (finish): revert to 1.60.
* lib/net/smtp.rb (finish): revert to 1.67.
* lib/net/http.rb (do_start): ensure to close socket if failed to start session.
* lib/net/pop.rb (do_start): ditto.
* lib/net/smtp.rb (do_start): ditto.
* lib/net/smtp.rb: SMTP#started? wrongly returned false always.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/pop.rb')
-rw-r--r-- | lib/net/pop.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/net/pop.rb b/lib/net/pop.rb index 00a7af2bdb..5ada68fd4d 100644 --- a/lib/net/pop.rb +++ b/lib/net/pop.rb @@ -415,7 +415,7 @@ module Net do_start account, password return yield(self) ensure - finish + do_finish end else do_start account, password @@ -434,6 +434,8 @@ module Net @command.auth account, password end @started = true + ensure + do_finish if not @started end private :do_start @@ -443,13 +445,20 @@ module Net # Finishes a POP3 session and closes TCP connection. def finish + raise IOError, 'POP session not started yet' unless started? + do_finish + end + + def do_finish @mails = nil @command.quit if @command + ensure + @started = false @command = nil @socket.close if @socket and not @socket.closed? @socket = nil - @started = false end + private :do_finish def command raise IOError, 'POP session not opened yet' \ |