Skip to content

Commit d686421

Browse files
committed
Close socket if the connection fails
1 parent b136202 commit d686421

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

ppadb/connection_async.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ async def connect(self):
3333
self.reader, self.writer = await asyncio.open_connection(self.host, self.port)
3434

3535
except (OSError, asyncio.TimeoutError) as e:
36+
await self.close()
3637
raise RuntimeError("ERROR: connecting to {}:{} {}.\nIs adb running on your computer?".format(self.host, self.port, e))
3738

3839
return self

0 commit comments

Comments
 (0)