def advanceQueue(self, n):

        # Send first block of available messages
        while n.chatq and (type(n.chatq[0]) is not float):
            msg = n.chatq.pop(0)
            n.chatq_base = (n.chatq_base + 1) % 0x100000000
            self.sendMessage(n, msg)

        dcall_discard(n, 'chatq_dcall')

        # If any messages remain, send them later.
        if not n.chatq:
            return

        def cb():
            n.chatq_dcall = None

            # Forget any missing messages at the beginning
            while n.chatq and (type(n.chatq[0]) is float):
                n.chatq.pop(0)
                n.chatq_base = (n.chatq_base + 1) % 0x100000000

            # Send the first block of available messages
            self.advanceQueue(n)

        # The first queue entry contains a timestamp.
        # Let the gap survive for 2 seconds total.
        when = max(0, n.chatq[0] + 2.0 - seconds())
        n.chatq_dcall = reactor.callLater(when, cb)