Class: SSLGate::RawClient

Inherits:
EM::Connection
  • Object
show all
Defined in:
lib/ssl_gate/raw_gate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(q, parent) ⇒ RawClient

Returns a new instance of RawClient.



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ssl_gate/raw_gate.rb', line 8

def initialize(q, parent)
  set_sock_opt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) # Nagle off

  @parent = parent
  @queue = q

  cb = proc do |msg|
    msg ? send_data(msg) : close_connection
    q.pop(&cb)
  end
  q.pop(&cb)
end

Instance Attribute Details

#queueObject (readonly)

Returns the value of attribute queue.



6
7
8
# File 'lib/ssl_gate/raw_gate.rb', line 6

def queue
  @queue
end

Instance Method Details

#receive_data(data) ⇒ Object



21
22
23
# File 'lib/ssl_gate/raw_gate.rb', line 21

def receive_data(data)
  @parent.send_data data
end

#unbindObject



25
26
27
# File 'lib/ssl_gate/raw_gate.rb', line 25

def unbind
  @parent.close_connection
end