Skip to content

Commit

Permalink
clean up remaining unclosed transport warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pipermerriam committed Nov 18, 2018
1 parent af7c49d commit 3149871
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions p2p/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,16 @@ async def handshake(
use_eip8 = False
initiator = HandshakeInitiator(remote, privkey, use_eip8, token)
reader, writer = await initiator.connect()
aes_secret, mac_secret, egress_mac, ingress_mac = await _handshake(
initiator, reader, writer, token)
try:
aes_secret, mac_secret, egress_mac, ingress_mac = await _handshake(
initiator, reader, writer, token)
except Exception:
if not reader.at_eof():
reader.feed_eof()
writer.close()
await asyncio.sleep(0)
raise

return aes_secret, mac_secret, egress_mac, ingress_mac, reader, writer


Expand Down

0 comments on commit 3149871

Please sign in to comment.