[CalendarServer-dev] [Workaround] Re: Exception in recvfd --was: Re: continuing work on FreeBSD ports
Axel Rau
Axel.Rau at chaos1.de
Fri Feb 22 04:20:23 PST 2013
Am 22.02.2013 um 10:58 schrieb Axel Rau:
> Unpacking to a long long instead an int seems to be a workaround:
Not really, because things like
packedFD="0x0e00000073c6e946"
converted to a long long breaks sendfdport etc.
Truncating to 4 bytes seems to work:
patch at the end of twext.python.sendfd.recvfd:
---
unpackedFD = 0
int_size = calcsize("i")
log.debug(str('recvfd: socketfd=%d, data="%s", flags=0x%s, cmsg_level=0x%s, cmsg_type=0x%s, packedFD="0x%s"'
% (socketfd, data, hex(long(flags)), hex(long(cmsg_level)), hex(long(cmsg_type)), packedFD.encode('hex_codec'))))
if len(packedFD) != int_size:
err_msg = str("recvfd: packedFD [%d] not %d bytes long" % (len(packedFD),int_size))
log.warn(err_msg)
if len(packedFD) > int_size:
[unpackedFD] = unpack("i", packedFD[0:int_size])
log.warn('recvfd: Truncating packedFD to %d bytes: %d.' % (int_size, unpackedFD))
else:
raise ValueError(err_msg)
else:
[unpackedFD] = unpack("i", packedFD)
return (unpackedFD, data)
---
At least this shows to me, that shipping FDs via AF_UNIX sockets works.
To find the real bug, I need advice.
Axel
---
PGP-Key:29E99DD6 ☀ +49 151 2300 9283 ☀ computing @ chaos claudius
More information about the calendarserver-dev
mailing list