summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-20 21:56:40 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-05-20 21:56:40 +0000
commitd795f2d1a803c03a7180f6f5049d3a9a0e8849f0 (patch)
treef7d664d38e75358c7e532c5d077ce7223d6dedec /lib
parent03570f8091bc5641bdb0020eccfa6bdf8556c8c3 (diff)
Shutdown gracefully.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/net/ftp.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 5be2981dd0..3684d1ebf4 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -433,6 +433,8 @@ module Net
end
conn = BufferedSocket.new(sock.accept)
conn.read_timeout = @read_timeout
+ sock.shutdown(Socket::SHUT_WR)
+ sock.read rescue nil
sock.close
end
return conn
@@ -487,6 +489,9 @@ module Net
break if data == nil
yield(data)
end
+ conn.shutdown(Socket::SHUT_WR)
+ conn.read_timeout = 1
+ conn.read
conn.close
voidresp
end
@@ -508,6 +513,9 @@ module Net
break if line == nil
yield(line.sub(/\r?\n\z/, ""), !line.match(/\n\z/).nil?)
end
+ conn.shutdown(Socket::SHUT_WR)
+ conn.read_timeout = 1
+ conn.read
conn.close
voidresp
end