#connect_known_peers ⇒ Object

317
318
319
320
321
322

# File 'lib/bitcoin/network/node.rb', line 317defconnect_known_peerslog.debug{"Attempting to connecting to known nodes"}Bitcoin.network[:known_nodes].shuffle[0..3].eachdo|node|connect_peernode,Bitcoin.network[:default_port]endend

#connect_peer(host, port) ⇒ Object

connect to peer at given host / port

294
295
296
297
298
299
300
301

# File 'lib/bitcoin/network/node.rb', line 294defconnect_peerhost,portreturnif@connections.map{|c|c.host}.include?(host)log.debug{"Attempting to connect to #{host}:#{port}"}EM.connect(host,port.to_i,ConnectionHandler,self,host,port.to_i,:out)rescuelog.debug{"Error connecting to #{host}:#{port}"}log.debug{$!.inspect}end