diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-10-24 08:13:13 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-10-24 08:19:36 +0000 |
commit | 2ce0b4a31bfae0b632d7ca031a52b24db7cc1b26 (patch) | |
tree | 4946ae60c5599638d06ec3920e2757b6899328fe | |
parent | 2cbeef0f29be4de815b802e705528b6f05d1bb29 (diff) | |
download | mogilefs-client-2ce0b4a31bfae0b632d7ca031a52b24db7cc1b26.tar.gz |
We don't need to set socket keepalive until we've successfully written the request out and are awaiting a response.
-rw-r--r-- | lib/mogilefs/http_file.rb | 1 | ||||
-rw-r--r-- | lib/mogilefs/new_file/common.rb | 1 | ||||
-rw-r--r-- | lib/mogilefs/new_file/stream.rb | 1 |
3 files changed, 1 insertions, 2 deletions
diff --git a/lib/mogilefs/http_file.rb b/lib/mogilefs/http_file.rb index c96e695..85b4578 100644 --- a/lib/mogilefs/http_file.rb +++ b/lib/mogilefs/http_file.rb @@ -95,7 +95,6 @@ class MogileFS::HTTPFile < StringIO # returns file size if the socket finished writing def upload(devid, uri) # :nodoc: sock = MogileFS::Socket.tcp(uri.host, uri.port) - set_socket_options(sock) file_size = length if @streaming_io diff --git a/lib/mogilefs/new_file/common.rb b/lib/mogilefs/new_file/common.rb index 9b6511d..1d2b1a0 100644 --- a/lib/mogilefs/new_file/common.rb +++ b/lib/mogilefs/new_file/common.rb @@ -21,6 +21,7 @@ module MogileFS::NewFile::Common def read_response(sock) tout = @opts[:new_file_max_time] || 3600.0 start_time = @opts[:start_time] and tout -= Time.now - start_time + set_socket_options(sock) case line = sock.timed_read(23, "", tout > 0.0 ? tout : 0) when %r{^HTTP/\d\.\d\s+(2\d\d)\s} # success! when nil diff --git a/lib/mogilefs/new_file/stream.rb b/lib/mogilefs/new_file/stream.rb index b2253f0..32bd339 100644 --- a/lib/mogilefs/new_file/stream.rb +++ b/lib/mogilefs/new_file/stream.rb @@ -18,7 +18,6 @@ class MogileFS::NewFile::Stream begin uri = URI.parse(path) sock = MogileFS::Socket.tcp(uri.host, uri.port) - set_socket_options(sock) start_sock(sock, uri) # raise on errors @to_io = sock @uri = uri |