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)
|