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

Ignore exceptions when closing data connections [Bug #16780]

Patch by koshigoe (Masataka SUZUKI). Thanks!
This commit is contained in:
Shugo Maeda 2020-05-19 17:46:21 +09:00
parent 1f063abb4c
commit 5e81e8675a
No known key found for this signature in database
GPG key ID: 2DFE34085E97CE47

View file

@ -634,9 +634,9 @@ module Net
while data = conn.read(blocksize)
yield(data)
end
conn.shutdown(Socket::SHUT_WR)
conn.shutdown(Socket::SHUT_WR) rescue nil
conn.read_timeout = 1
conn.read
conn.read rescue nil
ensure
conn.close if conn
end
@ -659,9 +659,9 @@ module Net
while line = conn.gets
yield(line.sub(/\r?\n\z/, ""), !line.match(/\n\z/).nil?)
end
conn.shutdown(Socket::SHUT_WR)
conn.shutdown(Socket::SHUT_WR) rescue nil
conn.read_timeout = 1
conn.read
conn.read rescue nil
ensure
conn.close if conn
end
@ -688,9 +688,9 @@ module Net
conn.write(buf)
yield(buf) if block_given?
end
conn.shutdown(Socket::SHUT_WR)
conn.shutdown(Socket::SHUT_WR) rescue nil
conn.read_timeout = 1
conn.read
conn.read rescue nil
ensure
conn.close if conn
end
@ -724,9 +724,9 @@ module Net
conn.write(buf)
yield(buf) if block_given?
end
conn.shutdown(Socket::SHUT_WR)
conn.shutdown(Socket::SHUT_WR) rescue nil
conn.read_timeout = 1
conn.read
conn.read rescue nil
ensure
conn.close if conn
end