Class: RIMS::Protocol::ConnectionTimer

Inherits:
Object
  • Object
show all
Defined in:
lib/rims/protocol/connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(limits, read_io) ⇒ ConnectionTimer

Returns a new instance of ConnectionTimer.



34
35
36
37
38
# File 'lib/rims/protocol/connection.rb', line 34

def initialize(limits, read_io)
  @limits = limits
  @read_poll = Riser::ReadPoll.new(read_io)
  @command_wait_timeout = false
end

Instance Method Details

#command_waitObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/rims/protocol/connection.rb', line 40

def command_wait
  if (@limits.command_wait_timeout_seconds == 0) then
    if (@read_poll.call(0) != nil) then
      return self
    else
      @command_wait_timeout = true
      return
    end
  end

  @read_poll.reset_timer
  until (@read_poll.call(@limits.read_polling_interval_seconds) != nil)
    if (@read_poll.interval_seconds >= @limits.command_wait_timeout_seconds) then
      @command_wait_timeout = true
      return
    end
  end

  self
end

#command_wait_timeout?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/rims/protocol/connection.rb', line 61

def command_wait_timeout?
  @command_wait_timeout
end