Skip to content

Commit

Permalink
Revert ":recycle: Moved trash message up"
Browse files Browse the repository at this point in the history
This reverts commit fd2674c.
  • Loading branch information
ThatXliner committed Jan 4, 2024
1 parent ccfa0de commit e27360e
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions aioudp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@
class _ClientProtocol(asyncio.DatagramProtocol):
msg_queue: asyncio.Queue[None | bytes]

def connection_made(
self,
transport: asyncio.DatagramTransport, # type: ignore[override]
# I am aware of the Liskov subsitution principle
# but asyncio.DatagramProtocol had this function signature
) -> None:
# This is to make sure that the connection works
# See https://github.com/ThatXliner/aioudp/pull/3 for more information
transport.sendto(b"trash")

def datagram_received(self, data: bytes, _: connection.AddrType) -> None:
self.msg_queue.put_nowait(data)

Expand Down Expand Up @@ -73,6 +63,9 @@ async def connect(host: str, port: int) -> AsyncIterator[connection.Connection]:
get_remote_addr=functools.partial(transport.get_extra_info, "peername"),
)
try:
# This is to make sure that the connection works
# See https://github.com/ThatXliner/aioudp/pull/3 for more information
await conn.send(b"trash")
yield conn
finally:
transport.close()

0 comments on commit e27360e

Please sign in to comment.