jsoncomm: remove destination from send

Now that jsoncomm.Socket is using a connection-oriented socket,
the destination in `socket.sendmsg` is ignored and thus can and
should be dropped from the `jsoncomm.Socket.send` method.
Adjust the tests accordingly.
This commit is contained in:
Christian Kellner 2020-07-28 12:58:57 +02:00 committed by Tom Gundersen
parent 43db8082bd
commit 785f843901
2 changed files with 4 additions and 4 deletions

View file

@ -321,7 +321,7 @@ class Socket(contextlib.AbstractContextManager):
return (payload, fdset, msg[3])
def send(self, payload: object, *, destination: Optional[str] = None, fds: Optional[list] = None):
def send(self, payload: object, *, fds: Optional[list] = None):
"""Send Message
Send a new message via this socket. This operation is synchronous. The
@ -352,5 +352,5 @@ class Socket(contextlib.AbstractContextManager):
if fds:
cmsg.append((socket.SOL_SOCKET, socket.SCM_RIGHTS, array.array("i", fds)))
n = self._socket.sendmsg([serialized], cmsg, 0, destination)
n = self._socket.sendmsg([serialized], cmsg, 0)
assert n == len(serialized)

View file

@ -84,7 +84,7 @@ class TestUtilJsonComm(unittest.TestCase):
assert msg[0] == data
assert len(msg[1]) == 0
self.server.send(data, destination=msg[2])
self.server.send(data)
msg = self.client.recv()
assert msg[0] == data
assert len(msg[1]) == 0
@ -154,7 +154,7 @@ class TestUtilJsonComm(unittest.TestCase):
def echo(socket):
msg = socket.recv()
socket.send(msg[0], destination=msg[2])
socket.send(msg[0])
loop.stop()
self.client.send({})