def request_done(self, request):
        """Called by the active request when it is done writing"""
        if self._requests is None:
            # Channel been cleaned up because the connection was lost.
            return

        assert request == self._requests[0], "Unexpected request done"
        del self._requests[0]

        if request.persistent:
            # Activate the next request in the pipeline if any
            if self._requests:
                self._requests[0].activate()
        else:
            self.transport.loseConnection()
Called by the active request when it is done writing