Skip to content

Commit 9780bf7

Browse files
committed
close_async check connection is closed already
1 parent 2cf6b2f commit 9780bf7

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)