def closed(self): log.msg('closed %s' % self) if len(self.conn.channels) == 1: # just us left reactor.stop()