Package pyxmpp2 :: Module resolver :: Class ThreadedResolverBase
[hide private]

Class ThreadedResolverBase


Base class for threaded resolvers.

Starts worker threads, each running a blocking resolver implementation and communicates with them to provide non-blocking asynchronous API.

Nested Classes [hide private]

Inherited from interfaces.Resolver: __metaclass__

Instance Methods [hide private]
 
__init__(self, settings=None, max_threads=1)
x.__init__(...) initializes x; see help(type(x)) for signature
 
_make_resolver(self)
Return the blocking resolver implementation that should be used by the resolver threads.
 
stop(self)
Stop the resolver threads.
 
_start_thread(self)
Start a new working thread unless the maximum number of threads has been reached or the request queue is empty.
 
resolve_address(self, hostname, callback, allow_cname=True)
Start looking up an A or AAAA record.
 
resolve_srv(self, domain, service, protocol, callback)
Start looking up an SRV record for service at domain.
 
_run(self, thread_n)
The thread function.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __abstractmethods__ = frozenset([])
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, settings=None, max_threads=1)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__
(inherited documentation)

resolve_address(self, hostname, callback, allow_cname=True)

 

Start looking up an A or AAAA record.

callback will be called with a list of IPv4 or IPv6 address literals on success. The list will be empty on error.

Parameters:
  • hostname - the host name to look up
  • callback - a function to be called with a list of received addresses
  • allow_cname - True if CNAMEs should be followed
Overrides: interfaces.Resolver.resolve_address
(inherited documentation)

resolve_srv(self, domain, service, protocol, callback)

 

Start looking up an SRV record for service at domain.

callback will be called with a properly sorted list of (hostname, port) pairs on success. The list will be empty on error and it will contain only (".", 0) when the service is explicitely disabled.

Parameters:
  • domain - domain name to look up
  • service - service name e.g. 'xmpp-client'
  • protocol - protocol name, e.g. 'tcp'
  • callback - a function to be called with a list of received addresses
Overrides: interfaces.Resolver.resolve_srv
(inherited documentation)