Class: Async::DNS::Resolver::Request
- Inherits:
-
Object
- Object
- Async::DNS::Resolver::Request
- Defined in:
- lib/async/dns/resolver.rb
Overview
Manages a single DNS question message across one or more servers.
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#packet ⇒ Object
readonly
Returns the value of attribute packet.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(message, endpoints) ⇒ Request
constructor
A new instance of Request.
- #update_id!(id) ⇒ Object
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(, endpoints) @message = @packet = .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
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
248 249 250 |
# File 'lib/async/dns/resolver.rb', line 248 def logger @logger end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
246 247 248 |
# File 'lib/async/dns/resolver.rb', line 246 def @message end |
#packet ⇒ Object (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 |