1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/net/imap.rb (disconnect): terminates @receiver_thread even if

@sock.shutdown raises an exception.  [ruby-dev:34881]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2010-05-08 23:25:54 +00:00
parent 81f4dba385
commit e240f93f21
3 changed files with 49 additions and 1 deletions

View file

@ -311,6 +311,43 @@ class IMAPTest < Test::Unit::TestCase
end
end
def test_exception_during_shutdown
server = TCPServer.new(0)
port = server.addr[1]
Thread.start do
begin
sock = server.accept
begin
sock.print("* OK test server\r\n")
sock.gets
sock.print("* BYE terminating connection\r\n")
sock.print("RUBY0001 OK LOGOUT completed\r\n")
ensure
sock.close
end
rescue
end
end
begin
begin
imap = Net::IMAP.new("localhost", :port => port)
imap.instance_eval do
def @sock.shutdown(*args)
super
raise "error"
end
end
imap.logout
ensure
assert_raise(RuntimeError) do
imap.disconnect
end
end
ensure
server.close
end
end
private
def imaps_test