Sha256: 4c10b99863f2e29278215bb2fa30cc720f3b3c0bd384b531c6c82f1a9389a64a
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
#!/usr/bin/env ruby Thread.abort_on_exception = true require_relative '../lib/buschtelefon' include Buschtelefon # A # ↕ # B ↔ D ↔ E # ↓ ↑ # C → F tattlers = { A: Tattler.new, B: Tattler.new, C: Tattler.new, D: Tattler.new, E: Tattler.new, F: Tattler.new } tattlers[:A].connect(tattlers[:B]) tattlers[:B].connect(tattlers[:A]) tattlers[:B].connect(tattlers[:C]) tattlers[:C].connect(tattlers[:F]) tattlers[:F].connect(tattlers[:D]) tattlers[:B].connect(tattlers[:D]) tattlers[:D].connect(tattlers[:B]) tattlers[:D].connect(tattlers[:E]) tattlers[:E].connect(tattlers[:D]) puts 'Feeding locals' tattlers[:A].feed(Gossip.new('Tezos')) simon = NetTattler.new josua = NetTattler.new remote_simon = josua.connect_remote(host: '127.0.0.1', port: simon.port) threads = [ Thread.new { josua.listen { |gossip, source| puts "I'm Josua, I got \"#{gossip.message}\" from #{source}" } }, Thread.new { simon.listen { |gossip, source| puts "I'm Simon, I got \"#{gossip.message}\" from #{source}" } } ] sleep(0.1) remote_simon.feed(Gossip.new('Antshare')) sleep(0.1) remote_simon.inquire sleep(0.1) threads.each(&:exit)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
buschtelefon-0.4.0 | bin/run |