about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-02-19 15:47:40 -0800
committerEric Wong <normalperson@yhbt.net>2010-02-19 15:47:40 -0800
commit3f714b9b60879e4e8ce9ed43c62ea9339a09ffe5 (patch)
treeb394510ace736f71c36af45ea3a13fe40007220d
parentda9f66a8c1cd76de75bf35a441d27492a29a9bf2 (diff)
downloadmogilefs-client-3f714b9b60879e4e8ce9ed43c62ea9339a09ffe5.tar.gz
It's needless optimization on a LAN (most places where MogileFS
is deployed) and the extra method calls in Ruby seem to force
more overhead in to the application.  So stop doing it.
-rw-r--r--lib/mogilefs/httpfile.rb2
-rw-r--r--lib/mogilefs/util.rb9
2 files changed, 0 insertions, 11 deletions
diff --git a/lib/mogilefs/httpfile.rb b/lib/mogilefs/httpfile.rb
index 3d42516..658b517 100644
--- a/lib/mogilefs/httpfile.rb
+++ b/lib/mogilefs/httpfile.rb
@@ -90,7 +90,6 @@ class MogileFS::HTTPFile < StringIO
   def upload(devid, uri)
     file_size = length
     sock = Socket.mogilefs_new(uri.host, uri.port)
-    sock.mogilefs_tcp_cork = true
 
     if @streaming_io
       file_size = @streaming_io.length
@@ -111,7 +110,6 @@ class MogileFS::HTTPFile < StringIO
       syswrite_full(sock, "PUT #{uri.request_uri} HTTP/1.0\r\n" \
                           "Content-Length: #{length}\r\n\r\n#{string}")
     end
-    sock.mogilefs_tcp_cork = false
 
     line = sock.gets or
       raise EmptyResponseError, 'Unable to read response line from server'
diff --git a/lib/mogilefs/util.rb b/lib/mogilefs/util.rb
index c2d792c..a783fd8 100644
--- a/lib/mogilefs/util.rb
+++ b/lib/mogilefs/util.rb
@@ -113,15 +113,6 @@ class MogileFS::Timeout < Timeout::Error; end
 class Socket
   attr_accessor :mogilefs_addr, :mogilefs_connected, :mogilefs_size
 
-  TCP_CORK = 3 if ! defined?(TCP_CORK) && RUBY_PLATFORM =~ /linux/
-
-  def mogilefs_tcp_cork=(set)
-    if defined?(TCP_CORK)
-      self.setsockopt(SOL_TCP, TCP_CORK, set ? 1 : 0) rescue nil
-    end
-    set
-  end
-
   # Socket lacks peeraddr method of the IPSocket/TCPSocket classes
   def mogilefs_peername
     Socket.unpack_sockaddr_in(getpeername).reverse.map {|x| x.to_s }.join(':')