Class: Rev::DNSResolver::Timeout

Inherits:
TimerWatcher show all
Defined in:
lib/rev/dns_resolver.rb

Instance Method Summary collapse

Methods inherited from TimerWatcher

#attach, #detach, #disable, #enable, #reset

Methods inherited from Watcher

#attach, #attached?, #detach, #disable, #enable, event_callback, #evloop, watcher_delegate

Constructor Details

#initialize(resolver) ⇒ Timeout

Returns a new instance of Timeout.



163
164
165
166
167
# File 'lib/rev/dns_resolver.rb', line 163

def initialize(resolver)
  @resolver = resolver
  @attempts = 0
  super(TIMEOUT, true)
end

Instance Method Details

#on_timerObject



169
170
171
172
173
174
175
# File 'lib/rev/dns_resolver.rb', line 169

def on_timer
  @attempts += 1
  return @resolver.send_request if @attempts <= RETRIES 
  
  @resolver.on_timeout
  @resolver.detach
end