def _get_receivers_addresses(self):
"""Retrieve all the addresses associated with a hostname.
It will return in priority the address of the last known receiver which
accepted the previous check.
"""
receivers = socket.getaddrinfo(
self.config['server'], self.config['port'],
proto=socket.IPPROTO_TCP
)
# Only keep the actual address
addresses = [r[4][0] for r in receivers]
try:
addresses.remove(self._last_good_receiver_address)
addresses = [self._last_good_receiver_address] + addresses
except ValueError:
pass
return addresses
评论列表
文章目录