Skip to content

Commit 364183a

Browse files
committed
avoid potential AttributeError on Linux
1 parent 6d6ed34 commit 364183a

File tree

1 file changed

+4
-1
lines changed
  • can/interfaces/udp_multicast

1 file changed

+4
-1
lines changed

can/interfaces/udp_multicast/bus.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
SO_TIMESTAMPNS = 35
3535
SIOCGSTAMP = 0x8906
3636

37+
# Additional constants for the interaction with the Winsock API
38+
WSAEINVAL = 10022
39+
3740

3841
class UdpMulticastBus(BusABC):
3942
"""A virtual interface for CAN communications between multiple processes using UDP over Multicast IP.
@@ -279,7 +282,7 @@ def _create_socket(self, address_family: socket.AddressFamily) -> socket.socket:
279282
if (
280283
error.errno == errno.ENOPROTOOPT
281284
or error.errno == errno.EINVAL
282-
or error.errno == errno.WSAEINVAL
285+
or error.errno == WSAEINVAL
283286
): # It is unavailable on macOS (ENOPROTOOPT) or windows(EINVAL/WSAEINVAL)
284287
self.timestamp_nanosecond = False
285288
else:

0 commit comments

Comments
 (0)