Partition the ``addrinfo`` list by address family. Returns two lists. The first list contains the first entry from ``addrinfo`` and all others with the same family, and the second list contains all other addresses (normally one list will be AF_INET and the other AF_
(
addrinfo: List[Tuple],
)
| 78 | |
| 79 | @staticmethod |
| 80 | def split( |
| 81 | addrinfo: List[Tuple], |
| 82 | ) -> Tuple[ |
| 83 | List[Tuple[socket.AddressFamily, Tuple]], |
| 84 | List[Tuple[socket.AddressFamily, Tuple]], |
| 85 | ]: |
| 86 | """Partition the ``addrinfo`` list by address family. |
| 87 | |
| 88 | Returns two lists. The first list contains the first entry from |
| 89 | ``addrinfo`` and all others with the same family, and the |
| 90 | second list contains all other addresses (normally one list will |
| 91 | be AF_INET and the other AF_INET6, although non-standard resolvers |
| 92 | may return additional families). |
| 93 | """ |
| 94 | primary = [] |
| 95 | secondary = [] |
| 96 | primary_af = addrinfo[0][0] |
| 97 | for af, addr in addrinfo: |
| 98 | if af == primary_af: |
| 99 | primary.append((af, addr)) |
| 100 | else: |
| 101 | secondary.append((af, addr)) |
| 102 | return primary, secondary |
| 103 | |
| 104 | def start( |
| 105 | self, |