'If connected, send all waiting messages.'

def send(self):

    if self.connected:
        while (len(self.factory.queued_messages) > 0):
            (exchange, r_key, message) = self.factory.queued_messages.pop(0)
            self.send_message(exchange, r_key, message)
