/* Called from timer task to run mDNS responder.  */
static void _mdns_scheduler_run()
/* Called from timer task to run mDNS responder.  */
static void _mdns_scheduler_run()
{
    MDNS_SERVICE_LOCK();
    mdns_tx_packet_t * p = _mdns_server->tx_queue_head;
    mdns_action_t * action = NULL;
    if (!p) {
        MDNS_SERVICE_UNLOCK();
        return;
    }
    if ((int32_t)(p->send_at - (xTaskGetTickCount() * portTICK_PERIOD_MS)) < 0) {
        action = (mdns_action_t *)malloc(sizeof(mdns_action_t));
        if (action) {
            _mdns_server->tx_queue_head = p->next;
            action->type = ACTION_TX_HANDLE;
            action->data.tx_handle.packet = p;
            if (xQueueSend(_mdns_server->action_queue, &action, (portTickType)0) != pdPASS) {
                free(action);
                _mdns_server->tx_queue_head = p;
            }
        } else {
            HOOK_MALLOC_FAILED;
        }
    }
    MDNS_SERVICE_UNLOCK();
}