about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-11-01 23:30:41 +0000
committerEric Wong <normalperson@yhbt.net>2011-11-01 23:30:41 +0000
commit60a29ca15a1d90cb7ef011719111e3d6d5691614 (patch)
tree2da967bf2e09492ef963da41ee8a2c6b1069ab6b
parent0bffe57f784b40dc355c2eca82d1d7a8cab09093 (diff)
downloadmogilefs-client-60a29ca15a1d90cb7ef011719111e3d6d5691614.tar.gz
Since Sockets default to IO#sync=true, IO#write is
just like syswrite_full and there's no reason to
continue using it.
-rw-r--r--lib/mogilefs/httpfile.rb16
1 files 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