Skip to content

Commit

Permalink
udp: change on_receive signature
Browse files Browse the repository at this point in the history
  • Loading branch information
koehlma committed Feb 13, 2016
1 parent e46cdff commit 5054fb6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions tests/test_udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class TestUDP(common.TestCase):
def test_udp(self):
self.datagram = None

def on_receive(udp_handle, status, address, length, data, flags):
def on_receive(udp_handle, status, address, data, flags):
self.datagram = data
udp_handle.receive_stop()

Expand All @@ -63,7 +63,7 @@ def test_udp_multicast(self):
self.clients = []
self.results = []

def on_receive(client, status, address, length, data, flags):
def on_receive(client, status, address, data, flags):
self.results.append(data)
client.receive_stop()

Expand All @@ -85,7 +85,7 @@ def on_receive(client, status, address, length, data, flags):
def test_udp_multicast_loop(self):
self.datagram = None

def on_receive(client, status, address, length, data, flags):
def on_receive(client, status, address, data, flags):
self.datagram = data
client.receive_stop()

Expand All @@ -104,7 +104,7 @@ def on_receive(client, status, address, length, data, flags):
def test_udp_broadcast(self):
self.datagram = None

def on_receive(server, status, address, length, data, flags):
def on_receive(server, status, address, data, flags):
self.datagram = data
server.close()

Expand All @@ -125,7 +125,7 @@ def on_receive(server, status, address, length, data, flags):
def test_udp_try_send(self):
self.datagram = None

def on_receive(udp_handle, status, address, length, data, flags):
def on_receive(udp_handle, status, address, data, flags):
self.datagram = data
udp_handle.receive_stop()

Expand Down
4 changes: 2 additions & 2 deletions uv/handles/udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ def __init__(self, udp, buffers, address, on_send=None):
def uv_udp_recv_cb(udp_handle, length, uv_buf, c_sockaddr, flags):
data = udp_handle.loop.allocator.finalize(udp_handle, length, uv_buf)
if length < 0: # pragma: no cover
length, status = 0, length
status = 0
else:
status = error.StatusCodes.SUCCESS
if c_sockaddr:
address = dns.unpack_sockaddr(c_sockaddr)
else:
address = None
udp_handle.on_receive(udp_handle, status, address, length, data, flags)
udp_handle.on_receive(udp_handle, status, address, data, flags)


@handle.HandleTypes.UDP
Expand Down

0 comments on commit 5054fb6

Please sign in to comment.