class Sanford::Worker::Connection

Constants

DEFAULT_TIMEOUT

Attributes

timeout[R]

Public Class Methods

new(socket) click to toggle source
# File lib/sanford/worker.rb, line 40
def initialize(socket)
  @socket     = socket
  @connection = Sanford::Protocol::Connection.new(@socket)
  @timeout    = (ENV['SANFORD_TIMEOUT'] || DEFAULT_TIMEOUT).to_f
end

Public Instance Methods

close() click to toggle source
# File lib/sanford/worker.rb, line 54
def close;       @connection.close;          end
close_write() click to toggle source
# File lib/sanford/worker.rb, line 55
def close_write; @connection.close_write;    end
peek_data() click to toggle source
# File lib/sanford/worker.rb, line 53
def peek_data;   @connection.peek(@timeout); end
read_data() click to toggle source
# File lib/sanford/worker.rb, line 52
def read_data;   @connection.read(@timeout); end
write_data(data) click to toggle source
# File lib/sanford/worker.rb, line 46
def write_data(data)
  TCPCork.apply(@socket)
  @connection.write data
  TCPCork.remove(@socket)
end