Mercurial > hg
changeset 28249:c16949fcb566
zeroconf: fix setsockopt() call on Solaris to send payload of correct length
The zeroconf extension has been broken on Solaris since the beginning, but
no one noticed until the testsuite started poking it after changeset
72f2a19c5f88, when it started running "hg paths" with the extension
enabled.
Solaris requires that, for IP_MULTICAST_{TTL,LOOP}, the argument passed in
be of length 1. With the original code here, it gets passed in as an int
-- length 4 -- and so the system call fails with EINVAL. Thankfully,
Python's socket.setsockopt() allows you to pass in a string instead of an
integer, and it passes that string to libc's setsockopt() with the correct
value and length.
author | Danek Duvall <danek.duvall@oracle.com> |
---|---|
date | Wed, 24 Feb 2016 22:22:18 -0800 |
parents | 851c41a21869 |
children | 6d0d11731e1c |
files | hgext/zeroconf/Zeroconf.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/zeroconf/Zeroconf.py Wed Feb 03 04:54:40 2016 +0000 +++ b/hgext/zeroconf/Zeroconf.py Wed Feb 24 22:22:18 2016 -0800 @@ -1266,8 +1266,8 @@ # work as expected. # pass - self.socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_TTL, 255) - self.socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_LOOP, 1) + self.socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_TTL, "\xff") + self.socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_LOOP, "\x01") try: self.socket.bind(self.group) except Exception: