Class: Async::DNS::Resolver::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/async/dns/resolver.rb

Overview

Manages a single DNS question message across one or more servers.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, endpoints) ⇒ Request

Returns a new instance of Request.



234
235
236
237
238
239
240
241
242
243
244
# File 'lib/async/dns/resolver.rb', line 234

def initialize(message, endpoints)
	@message = message
	@packet = message.encode
	
	@endpoints = endpoints.dup
	
	# We select the protocol based on the size of the data:
	if @packet.bytesize > UDP_TRUNCATION_SIZE
		@endpoints.delete_if{|server| server[0] == :udp}
	end
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



248
249
250
# File 'lib/async/dns/resolver.rb', line 248

def logger
  @logger
end

#messageObject (readonly)

Returns the value of attribute message.



246
247
248
# File 'lib/async/dns/resolver.rb', line 246

def message
  @message
end

#packetObject (readonly)

Returns the value of attribute packet.



247
248
249
# File 'lib/async/dns/resolver.rb', line 247

def packet
  @packet
end

Instance Method Details

#each(&block) ⇒ Object



250
251
252
# File 'lib/async/dns/resolver.rb', line 250

def each(&block)
	Async::IO::Endpoint.each(@endpoints, &block)
end

#update_id!(id) ⇒ Object



254
255
256
257
# File 'lib/async/dns/resolver.rb', line 254

def update_id!(id)
	@message.id = id
	@packet = @message.encode
end