* lib/ftp/ftp.rb (Net::FTP#close): restore original read_timeout.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-04-04 04:10:58 +00:00
parent f0cd9107df
commit 7865005fa1
3 changed files with 14 additions and 5 deletions

View file

@ -933,10 +933,14 @@ module Net
#
def close
if @sock and not @sock.closed?
@sock.shutdown(Socket::SHUT_WR) rescue nil
@sock.read_timeout = 3
@sock.read rescue nil
@sock.close
begin
@sock.shutdown(Socket::SHUT_WR) rescue nil
orig, self.read_timeout = self.read_timeout, 3
@sock.read rescue nil
ensure
@sock.close
self.read_timeout = orig
end
end
end