diff options
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/ftp.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb index 3dc1e2efb4..5be2981dd0 100644 --- a/lib/net/ftp.rb +++ b/lib/net/ftp.rb @@ -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 |