##// END OF EJS Templates
zeroconf: fix an invalid argument error on Windows...
Matt Harbison -
r52892:997c9b20 default
parent child Browse files
Show More
@@ -232,6 +232,16 class BadDomainNameCircular(BadDomainNam
232
232
233 # implementation classes
233 # implementation classes
234
234
235 _SOL_IP = socket.SOL_IP
236
237 if pycompat.iswindows:
238 # XXX: Not sure if there are newer versions of python where this would fail,
239 # but apparently socket.SOL_IP used to be 0, and socket.IPPROTO_IP is 0, so
240 # this would work with older versions of python.
241 #
242 # https://github.com/python/cpython/issues/101960
243 _SOL_IP = socket.IPPROTO_IP
244
235
245
236 class DNSEntry:
246 class DNSEntry:
237 """A DNS entry"""
247 """A DNS entry"""
@@ -1419,8 +1429,8 class Zeroconf:
1419 # work as expected.
1429 # work as expected.
1420 #
1430 #
1421 pass
1431 pass
1422 self.socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_TTL, b"\xff")
1432 self.socket.setsockopt(_SOL_IP, socket.IP_MULTICAST_TTL, b"\xff")
1423 self.socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_LOOP, b"\x01")
1433 self.socket.setsockopt(_SOL_IP, socket.IP_MULTICAST_LOOP, b"\x01")
1424 try:
1434 try:
1425 self.socket.bind(self.group)
1435 self.socket.bind(self.group)
1426 except Exception:
1436 except Exception:
@@ -1428,7 +1438,7 class Zeroconf:
1428 # SO_REUSEADDR and SO_REUSEPORT have been set, so ignore it
1438 # SO_REUSEADDR and SO_REUSEPORT have been set, so ignore it
1429 pass
1439 pass
1430 self.socket.setsockopt(
1440 self.socket.setsockopt(
1431 socket.SOL_IP,
1441 _SOL_IP,
1432 socket.IP_ADD_MEMBERSHIP,
1442 socket.IP_ADD_MEMBERSHIP,
1433 socket.inet_aton(_MDNS_ADDR) + socket.inet_aton('0.0.0.0'),
1443 socket.inet_aton(_MDNS_ADDR) + socket.inet_aton('0.0.0.0'),
1434 )
1444 )
@@ -1844,7 +1854,7 class Zeroconf:
1844 self.engine.notify()
1854 self.engine.notify()
1845 self.unregisterAllServices()
1855 self.unregisterAllServices()
1846 self.socket.setsockopt(
1856 self.socket.setsockopt(
1847 socket.SOL_IP,
1857 _SOL_IP,
1848 socket.IP_DROP_MEMBERSHIP,
1858 socket.IP_DROP_MEMBERSHIP,
1849 socket.inet_aton(_MDNS_ADDR) + socket.inet_aton('0.0.0.0'),
1859 socket.inet_aton(_MDNS_ADDR) + socket.inet_aton('0.0.0.0'),
1850 )
1860 )
@@ -304,15 +304,6 Check that zeroconf respect HGRCSKIPREPO
304 config error at $TESTTMP/.hg/hgrc:3: [broken
304 config error at $TESTTMP/.hg/hgrc:3: [broken
305 [255]
305 [255]
306
306
307 XXX-PYOXIDIZER Pyoxidizer build have trouble with zeroconf for unclear reason,
308 we accept the bad output for now as this is the last thing in the way of
309 testing the pyoxidizer build.
310
311 #if no-pyoxidizer-in-filesystem
312 $ HGRCSKIPREPO=1 hg paths --config extensions.zeroconf=
307 $ HGRCSKIPREPO=1 hg paths --config extensions.zeroconf=
313 foo = $TESTTMP/bar
308 foo = $TESTTMP/bar
314 #else
309
315 $ HGRCSKIPREPO=1 hg paths --config extensions.zeroconf=
316 abort: An invalid argument was supplied (known-bad-output !)
317 [255]
318 #endif
@@ -140,21 +140,11 output:
140
140
141 zeroconf wraps ui.configitems(), which shouldn't crash at least:
141 zeroconf wraps ui.configitems(), which shouldn't crash at least:
142
142
143 XXX-PYOXIDIZER Pyoxidizer build have trouble with zeroconf for unclear reason,
144 we accept the bad output for now as this is the last thing in the way of
145 testing the pyoxidizer build.
146
147 #if no-pyoxidizer-in-filesystem
148 $ hg paths --config extensions.zeroconf=
143 $ hg paths --config extensions.zeroconf=
149 dupe = $TESTTMP/b#tip
144 dupe = $TESTTMP/b#tip
150 dupe:pushurl = https://example.com/dupe
145 dupe:pushurl = https://example.com/dupe
151 expand = $TESTTMP/a/$SOMETHING/bar
146 expand = $TESTTMP/a/$SOMETHING/bar
152 insecure = http://foo:***@example.com/
147 insecure = http://foo:***@example.com/
153 #else
154 $ hg paths --config extensions.zeroconf=
155 abort: An invalid argument was supplied (known-bad-output !)
156 [255]
157 #endif
158
148
159
149
160 $ cd ..
150 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now