Skip to content

Commit a4b3288

Browse files
committed
Merge pull request #20 from PyMySQL/fix/double-close
close_async check connection is closed already
2 parents 2cf6b2f + 9780bf7 commit a4b3288

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tornado_mysql/connections.py

+3
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,9 @@ def close(self):
624624
@gen.coroutine
625625
def close_async(self):
626626
"""Send the quit message and close the socket"""
627+
if self._stream is None or self._stream.closed():
628+
self._stream = None
629+
return
627630
send_data = struct.pack('<i', 1) + int2byte(COMMAND.COM_QUIT)
628631
yield self._stream.write(send_data)
629632
self.close()

0 commit comments

Comments
 (0)