Flushes messages through current HttpRequest and closes it.
            It assumes a current requesthandler and requires a lock
            on self.lock

def __flush(self, async=True):
        """ Flushes messages through current HttpRequest and closes it.
            It assumes a current requesthandler and requires a lock
            on self.lock """
        rh = self.rh
        messages = list(self.messages)
        stream_notices = list(self.stream_notices)
        self.stream_notices = []
        self.messages = []
        args = (rh, messages, stream_notices)
        if async:
            self.hub.threadPool.execute_named(self.__inner_flush,
                '%s __inner__flush' % self.hub.l.name, *args)
        else:
            self.__inner_flush(*args)
        self.rh = None
        self._set_timeout(int(time.time() + self.hub.timeout))