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

Shut down TLS connections gracefully.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
shugo 2016-11-19 04:19:35 +00:00
parent b1bd36bf8e
commit 5f03f753ee

View file

@ -1281,7 +1281,7 @@ module Net
def close def close
if @sock and not @sock.closed? if @sock and not @sock.closed?
begin begin
@bare_sock.shutdown(Socket::SHUT_WR) rescue nil @sock.shutdown(Socket::SHUT_WR) rescue nil
orig, self.read_timeout = self.read_timeout, 3 orig, self.read_timeout = self.read_timeout, 3
@sock.read rescue nil @sock.read rescue nil
ensure ensure
@ -1404,6 +1404,10 @@ module Net
end end
def shutdown(*args) def shutdown(*args)
if @io.respond_to?(:stop)
# shut down the TLS connection gracefully.
@io.stop
end
@io.to_io.shutdown(*args) @io.to_io.shutdown(*args)
end end