Skip to content

Instantly share code, notes, and snippets.

@anacrolix
Created July 30, 2020 01:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anacrolix/fa0768126ac3535787b307c124f626d2 to your computer and use it in GitHub Desktop.
async def sendto(self, bytes, addr):
try:
await self.socket.sendto(
bytes, addr,
)
finally:
exc_value = sys.exc_info()[1]
if exc_value is not None:
exc_value = str(exc_value)
with self.db_conn:
record_operation(
self.db_conn, "send", addr_for_db(addr), bytes, exc_value
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment