dump_fds: add flags and address parameter

Expose the flags, address parameter of the underlying sock.sendmsg
method, in order to be able to explicitly specify the recipient of
the message; as needed in connection-less mode.
This commit is contained in:
Christian Kellner 2019-10-27 10:32:30 +01:00 committed by Lars Karlitski
parent 1c5b97afbc
commit 76518db26b

View file

@ -25,8 +25,9 @@ def load_fds(sock, msglen):
return json.loads(msg), list(fds), addr
def dump_fds(sock, obj, fds):
sock.sendmsg([json.dumps(obj).encode('utf-8')], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array.array("i", fds))])
def dump_fds(sock, obj, fds, flags=0, addr=None):
ancillary = [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array.array("i", fds))]
sock.sendmsg([json.dumps(obj).encode('utf-8')], ancillary, flags, addr)
class LoopServer: