Module: Rubarb::Listener

Includes:
ConnectionId
Defined in:
lib/rubarb/server.rb

Constant Summary collapse

INCOMING_CONNECTION =
OUTGOING_CONNECTION =

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConnectionId

#complete_id?, #extract_id

Instance Attribute Details

#apiObject

Returns the value of attribute api.



133
134
135
# File 'lib/rubarb/server.rb', line 133

def api
  @api
end

#callbackObject

Returns the value of attribute callback.



135
136
137
# File 'lib/rubarb/server.rb', line 135

def callback
  @callback
end

#conn_idObject (readonly)

Returns the value of attribute conn_id.



131
132
133
# File 'lib/rubarb/server.rb', line 131

def conn_id
  @conn_id
end

#conn_id_generatorObject

Returns the value of attribute conn_id_generator.



130
131
132
# File 'lib/rubarb/server.rb', line 130

def conn_id_generator
  @conn_id_generator
end

#errbacksObject

Returns the value of attribute errbacks.



136
137
138
# File 'lib/rubarb/server.rb', line 136

def errbacks
  @errbacks
end

#external_protocolObject

Returns the value of attribute external_protocol.



139
140
141
# File 'lib/rubarb/server.rb', line 139

def external_protocol
  @external_protocol
end

#insecure_methodsObject

Returns the value of attribute insecure_methods.



138
139
140
# File 'lib/rubarb/server.rb', line 138

def insecure_methods
  @insecure_methods
end

#keep_alive_timeObject

Returns the value of attribute keep_alive_time.



140
141
142
# File 'lib/rubarb/server.rb', line 140

def keep_alive_time
  @keep_alive_time
end

#msg_id_generatorObject

Returns the value of attribute msg_id_generator.



132
133
134
# File 'lib/rubarb/server.rb', line 132

def msg_id_generator
  @msg_id_generator
end

#new_connection_callbackObject

Returns the value of attribute new_connection_callback.



134
135
136
# File 'lib/rubarb/server.rb', line 134

def new_connection_callback
  @new_connection_callback
end

#unbindbackObject

Returns the value of attribute unbindback.



137
138
139
# File 'lib/rubarb/server.rb', line 137

def unbindback
  @unbindback
end

Instance Method Details

#call_errbacks(message) ⇒ Object



163
164
165
166
167
# File 'lib/rubarb/server.rb', line 163

def call_errbacks(message)
  @errbacks.each do |e|
    e.call(message)
  end
end

#cancel_keep_aliveObject



153
154
155
# File 'lib/rubarb/server.rb', line 153

def cancel_keep_alive
  #will be replaced by later included modules
end

#post_initObject



144
145
146
# File 'lib/rubarb/server.rb', line 144

def post_init
  @buffer = ""
end

#receive_data(data) ⇒ Object



148
149
150
151
# File 'lib/rubarb/server.rb', line 148

def receive_data data
  @buffer << data
  handshake(@buffer) if @conn_id.nil?
end

#unbindObject



157
158
159
160
161
# File 'lib/rubarb/server.rb', line 157

def unbind
  cancel_keep_alive
  call_errbacks(ConnectionError.new)
  @unbindback.call(self) if @unbindback
end