Class: Resolv::DNS::Requester

Inherits:
Object
  • Object
show all
Defined in:
lib/net/dns/resolv.rb

Overview

:nodoc:

Direct Known Subclasses

ConnectedUDP, TCP, UnconnectedUDP

Defined Under Namespace

Classes: ConnectedUDP, RequestError, Sender, TCP, UnconnectedUDP

Instance Method Summary collapse

Constructor Details

#initializeRequester

Returns a new instance of Requester.



575
576
577
# File 'lib/net/dns/resolv.rb', line 575

def initialize
  @senders = {}
end

Instance Method Details

#closeObject



579
580
581
582
583
584
585
586
587
588
589
# File 'lib/net/dns/resolv.rb', line 579

def close
  thread, sock, @thread, @sock = @thread, @sock
  begin
    if thread
      thread.kill
      thread.join
    end
  ensure
    sock.close if sock
  end
end

#delete(arg) ⇒ Object



591
592
593
594
595
596
597
598
599
600
# File 'lib/net/dns/resolv.rb', line 591

def delete(arg)
  case arg
  when Sender
    @senders.delete_if {|k, s| s == arg }
  when Queue
    @senders.delete_if {|k, s| s.queue == arg }
  else
    raise ArgumentError.new("neither Sender or Queue: #{arg}")
  end
end