class Bitcourier::NodeManager
Constants
- MINIMUM_NODES
Attributes
context[RW]
nodes[RW]
Public Class Methods
new(context)
click to toggle source
# File lib/bitcourier/node_manager.rb, line 7 def initialize context self.nodes = [] self.context = context end
Public Instance Methods
add_socket(socket, active = false)
click to toggle source
# File lib/bitcourier/node_manager.rb, line 16 def add_socket socket, active = false node = Node.new context, socket if active node.set_state Node::ActiveHandshake else node.set_state Node::PassiveHandshake end nodes << node node.run end
needs_nodes?()
click to toggle source
# File lib/bitcourier/node_manager.rb, line 12 def needs_nodes? nodes.count < MINIMUM_NODES end