Skip to content

Commit

Permalink
Avoid shutdown on closed socket.
Browse files Browse the repository at this point in the history
Fix #1072.
  • Loading branch information
aaugustin committed Nov 6, 2021
1 parent ed9a7b4 commit 460b6f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/websockets/legacy/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ async def close_connection(self) -> None:
self.logger.debug("! timed out waiting for TCP close")

# Half-close the TCP connection if possible (when there's no TLS).
if self.transport.can_write_eof():
if self.transport.can_write_eof() and not self.transport.is_closing():
if self.debug:
self.logger.debug("x half-closing TCP connection")
self.transport.write_eof()
Expand Down

0 comments on commit 460b6f8

Please sign in to comment.