Class: P2p2::Paird
- Inherits:
-
Object
- Object
- P2p2::Paird
- Defined in:
- lib/p2p2/paird.rb
Instance Method Summary collapse
-
#initialize(config_path = nil) ⇒ Paird
constructor
A new instance of Paird.
Constructor Details
#initialize(config_path = nil) ⇒ Paird
Returns a new instance of Paird.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/p2p2/paird.rb', line 13 def initialize( config_path = nil ) if config_path then conf = JSON.parse( IO.binread( config_path ), symbolize_names: true ) paird_port = conf[ :paird_port ] infod_port = conf[ :infod_port ] end unless paird_port then paird_port = 4040 end unless infod_port then infod_port = 4050 end puts "p2p2 paird #{ P2p2::VERSION }" puts "paird #{ paird_port } infod #{ infod_port }" worker = P2p2::PairdWorker.new( paird_port, infod_port ) Signal.trap( :TERM ) do puts 'exit' worker.quit! end worker.looping end |