From 60a29ca15a1d90cb7ef011719111e3d6d5691614 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 1 Nov 2011 23:30:41 +0000 Subject: httpfile: remove silly syswrite_full usage Since Sockets default to IO#sync=true, IO#write is just like syswrite_full and there's no reason to continue using it. --- lib/mogilefs/httpfile.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/mogilefs/httpfile.rb b/lib/mogilefs/httpfile.rb index 6964d34..a1cd8d4 100644 --- a/lib/mogilefs/httpfile.rb +++ b/lib/mogilefs/httpfile.rb @@ -86,26 +86,26 @@ class MogileFS::HTTPFile < StringIO # returns file size if the socket finished writing def upload(devid, uri) file_size = length - sock = Socket.mogilefs_new(uri.host, uri.port) + sock = MogileFS::Socket.tcp(uri.host, uri.port) if @streaming_io file_size = @streaming_io.length - syswrite_full(sock, "PUT #{uri.request_uri} HTTP/1.0\r\n" \ - "Content-Length: #{file_size}\r\n\r\n") + sock.write("PUT #{uri.request_uri} HTTP/1.0\r\n" \ + "Content-Length: #{file_size}\r\n\r\n") @streaming_io.call(Proc.new do |data_to_write| - syswrite_full(sock, data_to_write) + sock.write(data_to_write) end) elsif @big_io # Don't try to run out of memory File.open(@big_io, "rb") do |fp| file_size = fp.stat.size - syswrite_full(sock, "PUT #{uri.request_uri} HTTP/1.0\r\n" \ - "Content-Length: #{file_size}\r\n\r\n") + sock.write("PUT #{uri.request_uri} HTTP/1.0\r\n" \ + "Content-Length: #{file_size}\r\n\r\n") sysrwloop(fp, sock) end else - syswrite_full(sock, "PUT #{uri.request_uri} HTTP/1.0\r\n" \ - "Content-Length: #{length}\r\n\r\n#{string}") + sock.write("PUT #{uri.request_uri} HTTP/1.0\r\n" \ + "Content-Length: #{length}\r\n\r\n#{string}") end line = sock.gets or -- cgit v1.2.3-24-ge0c7