def connection_lost(self, exc):
if exc:<EOL><INDENT>self.log.exception('<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>self.log.info('<STR_LIT>')<EOL><DEDENT>self._closed.set()<EOL>
Stop when connection is lost.