Closed kapetan closed 3 years ago
I can't guarantee MacOS support because there's no way I can test on this platform, but I would like to support platforms without nonblocking sockets. This is a feature only available in Linux >= 2.6.27. So you should add a feature check using platform.system. None of the code should require nonblocking sockets, but it is compatible with them.
Any platform that supports python3 and asyncio has nonblocking sockets :|
Oh yeah you're right. I misread the python docs. It's just a different way of setting the nonblocking socket in Darwin. I think you have to set O_NONBLOCK
with fcntl()
after socket creation in that case.
What's the correct approach here? I can add something like.
flag = fcntl.fcntl(self._sock.fileno(), fcntl.F_GETFL)
fcntl.fcntl(self._sock.fileno(), fcntl.F_SETFL, flag | os.O_NONBLOCK)
It can be hidden behind a feature flag.
I think that's probably already done in the call to sock.setblocking(False)
so this is probably fine.
:+1:
socket.SOCK_NONBLOCK
does not exist on macOS, so creating a dbus instance with an unix path fails. This fix uses same socket creation as with tcp. This works on macOS 10.15.6 with dbus 1.12.20, but I don't know if it has any consequences on other platforms.Running the tests locally with:
Where
DBUS_LAUNCHD_SESSION_BUS_SOCKET
is something like/private/tmp/com.apple.launchd/unix_domain_listener
.Results in two failed tests:
If I use
path
instead ofabstract
as dictionary key intest_tcp_connection_with_forwarding
the test passes.