File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2235,8 +2235,12 @@ def new_socket(
22352235 if ip_version != IPVersion .V6Only :
22362236 # OpenBSD needs the ttl and loop values for the IP_MULTICAST_TTL and
22372237 # IP_MULTICAST_LOOP socket options as an unsigned char.
2238- s .setsockopt (socket .IPPROTO_IP , socket .IP_MULTICAST_TTL , ttl )
2239- s .setsockopt (socket .IPPROTO_IP , socket .IP_MULTICAST_LOOP , loop )
2238+ try :
2239+ s .setsockopt (socket .IPPROTO_IP , socket .IP_MULTICAST_TTL , ttl )
2240+ s .setsockopt (socket .IPPROTO_IP , socket .IP_MULTICAST_LOOP , loop )
2241+ except socket .error as e :
2242+ if bind_addr [0 ] != '' or get_errno (e ) != errno .EINVAL : # Fails to set on MacOS
2243+ raise
22402244 if ip_version != IPVersion .V4Only :
22412245 # However, char doesn't work here (at least on Linux)
22422246 s .setsockopt (_IPPROTO_IPV6 , socket .IPV6_MULTICAST_HOPS , 255 )
You can’t perform that action at this time.
0 commit comments