Class: Thrift::UNIXServerSocket
Constant Summary
BaseServerTransport::DEFAULT_CLIENT_TIMEOUT
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(path, client_timeout: DEFAULT_CLIENT_TIMEOUT) ⇒ UNIXServerSocket
Returns a new instance of UNIXServerSocket.
26
27
28
29
30
|
# File 'lib/thrift/transport/unix_server_socket.rb', line 26
def initialize(path, client_timeout: DEFAULT_CLIENT_TIMEOUT)
@path = path
@client_timeout = client_timeout
@handle = nil
end
|
Instance Attribute Details
#client_timeout ⇒ Object
Returns the value of attribute client_timeout.
33
34
35
|
# File 'lib/thrift/transport/unix_server_socket.rb', line 33
def client_timeout
@client_timeout
end
|
#handle ⇒ Object
Also known as:
to_io
Returns the value of attribute handle.
32
33
34
|
# File 'lib/thrift/transport/unix_server_socket.rb', line 32
def handle
@handle
end
|
Instance Method Details
#accept ⇒ Object
39
40
41
42
43
44
45
46
47
|
# File 'lib/thrift/transport/unix_server_socket.rb', line 39
def accept
unless @handle.nil?
sock = @handle.accept
trans = UNIXSocket.new(nil)
trans.timeout = @client_timeout
trans.handle = sock
trans
end
end
|
#close ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'lib/thrift/transport/unix_server_socket.rb', line 49
def close
if @handle
@handle.close unless @handle.closed?
@handle = nil
File.delete(@path)
end
end
|
#closed? ⇒ Boolean
58
59
60
|
# File 'lib/thrift/transport/unix_server_socket.rb', line 58
def closed?
@handle.nil? or @handle.closed?
end
|
#listen ⇒ Object
35
36
37
|
# File 'lib/thrift/transport/unix_server_socket.rb', line 35
def listen
@handle = ::UNIXServer.new(@path)
end
|
#to_s ⇒ Object
64
65
66
|
# File 'lib/thrift/transport/unix_server_socket.rb', line 64
def to_s
"domain(#{@path})"
end
|