Package ldaptor :: Package protocols :: Package ldap :: Module ldapconnector :: Class LDAPConnector
[hide private]
[frames] | no frames]

Class LDAPConnector

source code

twisted.names.srvconnect.SRVConnector --+
                                        |
                                       LDAPConnector

Instance Methods [hide private]
 
__init__(self, reactor, dn, factory, overrides=None) source code
 
__getstate__(self) source code
 
_findOverRide(self, dn, overrides) source code
 
_isQueryNeeded(self)
Is there both need to do an SRV query.
source code
 
connect(self)
Start connection to remote server.
source code
tuple of native str and int
pickServer(self)
Pick the next server.
source code

Inherited from twisted.names.srvconnect.SRVConnector: __providedBy__, __provides__, connectionFailed, connectionLost, disconnect, getDestination, stopConnecting

Inherited from twisted.names.srvconnect.SRVConnector (private): _cbGotServers, _ebGotServers, _ebServiceUnknown, _reallyConnect

Class Variables [hide private]

Inherited from twisted.names.srvconnect.SRVConnector: __implemented__, stopAfterDNS

Instance Variables [hide private]

Inherited from twisted.names.srvconnect.SRVConnector: orderedServers, servers

Method Details [hide private]

__init__(self, reactor, dn, factory, overrides=None)
(Constructor)

source code 
Parameters:
  • domain - The domain to connect to. If passed as a unicode string, it will be encoded using idna encoding.
  • defaultPort - Optional default port number to be used when SRV lookup fails and the service name is unknown. This should be the port number associated with the service name as defined by the IANA registry.
Overrides: twisted.names.srvconnect.SRVConnector.__init__
(inherited documentation)

connect(self)

source code 

Start connection to remote server.

Overrides: twisted.names.srvconnect.SRVConnector.connect
(inherited documentation)

pickServer(self)

source code 

Pick the next server.

This selects the next server from the list of SRV records according to their priority and weight values, as set out by the default algorithm specified in RFC 2782.

At the beginning of a round, servers is populated with orderedServers, and the latter is made empty. servers is the list of candidates, and orderedServers is the list of servers that have already been tried.

First, all records are ordered by priority and weight in ascending order. Then for each priority level, a running sum is calculated over the sorted list of records for that priority. Then a random value between 0 and the final sum is compared to each record in order. The first record that is greater than or equal to that random value is chosen and removed from the list of candidates for this round.

Returns: tuple of native str and int
A tuple of target hostname and port from the chosen DNS SRV record.
Overrides: twisted.names.srvconnect.SRVConnector.pickServer
(inherited documentation)