Class: RSwim::Member::TransmissionState::AwaitingAck
- Defined in:
- lib/rswim/member/transmission_state/awaiting_ack.rb
Instance Method Summary collapse
- #advance(elapsed_seconds) ⇒ Object
-
#initialize(id, node_member_id, member_pool, source_ids, target_ids) ⇒ AwaitingAck
constructor
A new instance of AwaitingAck.
- #member_replied_with_ack ⇒ Object
Methods inherited from Base
#enqueue_ping, #enqueue_ping_from, #enqueue_ping_request, #prepare_output
Constructor Details
#initialize(id, node_member_id, member_pool, source_ids, target_ids) ⇒ AwaitingAck
Returns a new instance of AwaitingAck.
7 8 9 10 11 |
# File 'lib/rswim/member/transmission_state/awaiting_ack.rb', line 7 def initialize(id, node_member_id, member_pool, source_ids, target_ids) super @life_time_seconds = 0 @done = false end |
Instance Method Details
#advance(elapsed_seconds) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rswim/member/transmission_state/awaiting_ack.rb', line 22 def advance(elapsed_seconds) @life_time_seconds += elapsed_seconds if @done Ready.new(@id, @node_member_id, @member_pool, @source_ids, @target_ids) elsif @life_time_seconds > R_MS / 1000.0 if @source_ids.include?(@id) @member_pool.member_failed_to_reply(@id) end Ready.new(@id, @node_member_id, @member_pool, @source_ids, @target_ids) else self end end |
#member_replied_with_ack ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/rswim/member/transmission_state/awaiting_ack.rb', line 13 def member_replied_with_ack if @source_ids.include?(@id) @member_pool.member_replied_in_time(@id) end @source_ids.each { |i| @member_pool.forward_ack_to(i) unless i == @id } @source_ids.clear @done = true end |