- Downloads
Fix support for services connected via IPv6 (#1141)
* Fix support for services connected via IPv6 Use the correct address family when connecting to the various RPC services. The solution is basically the same suggested here: https://github.com/cms-dev/cms/issues/157#issuecomment-463427954 This work is the result of the work of @edomora97, @mark03 and @Dariost. * Mock getaddrinfo in test_background_connect Calling getaddrinfo somehow breaks the mocking interface of socket, replacing the MagicMock with the original function. This would break the assert and the test in general. To prevent so getaddrinfo is mocked as well, making it return just an address without side effects. * Try all the resolved addresses - Try to resolve only with the SOCK_STREAM type - Try to connect to all the resolved IP addresses, sometimes the first in the list is not the correct one (e.g. IPv4/v6) - Remove redundant getaddrinfo in _connection_handler * Stop after the first connection * Pass family, type and proto to socket.socket() As suggested in https://docs.python.org/3/library/socket.html#socket.getaddrinfo * Fix tests
Please sign in to comment