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

rescue EPIPE raised from conn.print because of client's timeout

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-05-22 12:35:18 +00:00
parent 8bcf7fc402
commit 3cbf88d8d4

View file

@ -327,19 +327,21 @@ class FTPTest < Test::Unit::TestCase
sock.print("200 PORT command successful.\r\n")
commands.push(sock.gets)
sock.print("150 Here comes the directory listing.\r\n")
conn = TCPSocket.new(host, port)
list_lines.each_with_index do |l, i|
if i == 1
sleep(0.5)
else
sleep(0.1)
begin
conn = TCPSocket.new(host, port)
list_lines.each_with_index do |l, i|
if i == 1
sleep(0.5)
else
sleep(0.1)
end
conn.print(l, "\r\n")
end
conn.print(l, "\r\n")
rescue Errno::EPIPE
ensure
assert_nil($!)
conn.close
end
conn.shutdown(Socket::SHUT_WR)
conn.read_timeout = 1
conn.read unless conn.eof?
conn.close
sock.print("226 Directory send OK.\r\n")
}
begin