Class: RSwim::Member::TransmissionState::SendingPingRequest

Inherits:
Base
  • Object
show all
Defined in:
lib/rswim/member/transmission_state/sending_ping_request.rb

Instance Method Summary collapse

Methods inherited from Base

#enqueue_ping, #enqueue_ping_from, #enqueue_ping_request

Constructor Details

#initialize(id, node_member_id, member_pool, source_ids, target_ids) ⇒ SendingPingRequest

Returns a new instance of SendingPingRequest.



7
8
9
10
# File 'lib/rswim/member/transmission_state/sending_ping_request.rb', line 7

def initialize(id, node_member_id, member_pool, source_ids, target_ids)
  super
  @done = false
end

Instance Method Details

#advance(_elapsed_seconds) ⇒ Object



16
17
18
19
20
# File 'lib/rswim/member/transmission_state/sending_ping_request.rb', line 16

def advance(_elapsed_seconds)
  if @done then AwaitingAck.new(@id, @node_member_id, @member_pool, @source_ids, @target_ids)
  else self
  end
end

#member_replied_with_ackObject



12
13
14
# File 'lib/rswim/member/transmission_state/sending_ping_request.rb', line 12

def member_replied_with_ack
  logger.debug("out of order ack from member #{@id}")
end

#prepare_outputObject



22
23
24
25
26
27
# File 'lib/rswim/member/transmission_state/sending_ping_request.rb', line 22

def prepare_output
  @done = true
  target_id = @target_ids.shift
  message = Message.new(@id, @node_member_id, :ping_req, target_id: target_id)
  [message]
end