class Bitcourier::Node::PassiveHandshake

Public Instance Methods

on_hello(msg) click to toggle source
# File lib/bitcourier/node.rb, line 50
def on_hello msg
  version_ok = msg.protocol_version == Protocol::Message::Hello::PROTOCOL_VERSION
  nonce_ok = msg.nonce != node.context.nonce

  if version_ok and nonce_ok
    node.remote_port = msg.port
    node.send_hello
    set_state ReadyState
  else
    node.disconnect
  end
end