* lib/webrick/server.rb (WEBrick::GenericServer#shutdown):

rescue Errno::ENOTCONN and close. [ruby-dev:35896]

* test/openssl/test_ssl.rb (OpenSSL#start_server): ditto.
  [ruby-dev:35897]

* lib/net/imap.rb (Net::IMAP#disconnect): ditto. [ruby-dev:35898]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kazu 2008-08-22 11:12:06 +00:00
Родитель 122595c263
Коммит 2d302dfd40
4 изменённых файлов: 37 добавлений и 8 удалений

Просмотреть файл

@ -1,3 +1,13 @@
Fri Aug 22 20:06:46 2008 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
* lib/webrick/server.rb (WEBrick::GenericServer#shutdown):
rescue Errno::ENOTCONN and close. [ruby-dev:35896]
* test/openssl/test_ssl.rb (OpenSSL#start_server): ditto.
[ruby-dev:35897]
* lib/net/imap.rb (Net::IMAP#disconnect): ditto. [ruby-dev:35898]
Fri Aug 22 19:58:27 2008 Tadayoshi Funaba <tadf@dotrb.org> Fri Aug 22 19:58:27 2008 Tadayoshi Funaba <tadf@dotrb.org>
* lib/date.rb: no need to require the "lib/rational.rb" any more. * lib/date.rb: no need to require the "lib/rational.rb" any more.

Просмотреть файл

@ -288,11 +288,15 @@ module Net
# Disconnects from the server. # Disconnects from the server.
def disconnect def disconnect
begin begin
# try to call SSL::SSLSocket#io. begin
@sock.io.shutdown # try to call SSL::SSLSocket#io.
rescue NoMethodError @sock.io.shutdown
# @sock is not an SSL::SSLSocket. rescue NoMethodError
@sock.shutdown # @sock is not an SSL::SSLSocket.
@sock.shutdown
end
rescue Errno::ENOTCONN
# ignore `Errno::ENOTCONN: Socket is not connected' on some platforms.
end end
@receiver_thread.join @receiver_thread.join
@sock.close @sock.close

Просмотреть файл

@ -130,9 +130,17 @@ module WEBrick
addr = s.addr addr = s.addr
@logger.debug("close TCPSocket(#{addr[2]}, #{addr[1]})") @logger.debug("close TCPSocket(#{addr[2]}, #{addr[1]})")
end end
s.shutdown begin
unless @config[:ShutdownSocketWithoutClose] s.shutdown
rescue Errno::ENOTCONN
# when `Errno::ENOTCONN: Socket is not connected' on some platforms,
# call #close instead of #shutdown.
# (ignore @config[:ShutdownSocketWithoutClose])
s.close s.close
else
unless @config[:ShutdownSocketWithoutClose]
s.close
end
end end
} }
@listeners.clear @listeners.clear

Просмотреть файл

@ -129,7 +129,14 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
block.call(server, port.to_i) block.call(server, port.to_i)
ensure ensure
begin begin
tcps.shutdown if (tcps) begin
tcps.shutdown
rescue Errno::ENOTCONN
# when `Errno::ENOTCONN: Socket is not connected' on some platforms,
# call #close instead of #shutdown.
tcps.close
tcps = nil
end if (tcps)
if (server) if (server)
server.join(5) server.join(5)
if server.alive? if server.alive?