Module: Perennial::Protocols::JSONTransport::InstanceMethods
- Defined in:
- lib/perennial/protocols/json_transport.rb
Instance Method Summary collapse
- #host_with_port ⇒ Object
- #post_connect ⇒ Object
- #post_init ⇒ Object
- #receive_data(data) ⇒ Object
- #send_message(line) ⇒ Object
- #ssl_handshake_complete ⇒ Object
- #use_ssl=(value) ⇒ Object
Instance Method Details
#host_with_port ⇒ Object
158 159 160 161 162 163 |
# File 'lib/perennial/protocols/json_transport.rb', line 158 def host_with_port @host_with_port ||= begin port, ip = Socket.unpack_sockaddr_in(get_peername) "#{ip}:#{port}" end end |
#post_connect ⇒ Object
170 171 |
# File 'lib/perennial/protocols/json_transport.rb', line 170 def post_connect end |
#post_init ⇒ Object
173 174 175 176 177 178 |
# File 'lib/perennial/protocols/json_transport.rb', line 173 def post_init if !connected? && !ssl_enabled? @connected = true post_connect end end |
#receive_data(data) ⇒ Object
148 149 150 151 152 |
# File 'lib/perennial/protocols/json_transport.rb', line 148 def receive_data(data) protocol_buffer.extract(data).each do |part| (part) end end |
#send_message(line) ⇒ Object
154 155 156 |
# File 'lib/perennial/protocols/json_transport.rb', line 154 def (line) send_data "#{line}#{SEPERATOR}" end |
#ssl_handshake_complete ⇒ Object
180 181 182 183 184 185 |
# File 'lib/perennial/protocols/json_transport.rb', line 180 def ssl_handshake_complete if !connected? @connected = true post_connect end end |
#use_ssl=(value) ⇒ Object
165 166 167 168 |
# File 'lib/perennial/protocols/json_transport.rb', line 165 def use_ssl=(value) @should_use_ssl = value enable_ssl if connected? end |