Sha256: a14ed949032bbac8056eb3e8d622c91c5035ad6dc152dfc770ab4d1540c0b425

Contents?: true

Size: 410 Bytes

Versions: 2

Compression:

Stored size: 410 Bytes

Contents

module Dcha
  class Peer
    # :nodoc:
    module CanHeartbeat
      def ping
        transmit action: :pong, params: [ipaddr.ip_address]
      end

      def pong(address)
        @peers.push(address).uniq!
        transmit action: :mine, params: [chain.blocks]
        return if ipaddr.ip_address == address
        transmit_to address, action: :pong, params: [ipaddr.ip_address]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dcha-0.1.3 lib/dcha/peer/can_heartbeat.rb
dcha-0.1.0 lib/dcha/peer/can_heartbeat.rb