]> git.proxmox.com Git - mirror_frr.git/blobdiff - isisd/isis_tx_queue.c
*: Convert thread_add_XXX functions to event_add_XXX
[mirror_frr.git] / isisd / isis_tx_queue.c
index d3da5b9d39aba480cf7f24a522db253262a493eb..e0c5e164f6d4af7bd39c393e1d0b5c7073c730b1 100644 (file)
@@ -1,23 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * IS-IS Rout(e)ing protocol - LSP TX Queuing logic
  *
  * Copyright (C) 2018 Christian Franke
  *
  * This file is part of FRRouting (FRR)
- *
- * FRR is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * FRR is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include <zebra.h>
 
@@ -45,7 +32,7 @@ struct isis_tx_queue_entry {
        struct isis_lsp *lsp;
        enum isis_tx_type type;
        bool is_retry;
-       struct thread *retry;
+       struct event *retry;
        struct isis_tx_queue *queue;
 };
 
@@ -92,15 +79,14 @@ static void tx_queue_element_free(void *element)
 {
        struct isis_tx_queue_entry *e = element;
 
-       thread_cancel(&(e->retry));
+       THREAD_OFF(e->retry);
 
        XFREE(MTYPE_TX_QUEUE_ENTRY, e);
 }
 
 void isis_tx_queue_free(struct isis_tx_queue *queue)
 {
-       hash_clean(queue->hash, tx_queue_element_free);
-       hash_free(queue->hash);
+       hash_clean_and_free(&queue->hash, tx_queue_element_free);
        XFREE(MTYPE_TX_QUEUE, queue);
 }
 
@@ -114,12 +100,12 @@ static struct isis_tx_queue_entry *tx_queue_find(struct isis_tx_queue *queue,
        return hash_lookup(queue->hash, &e);
 }
 
-static int tx_queue_send_event(struct thread *thread)
+static void tx_queue_send_event(struct event *thread)
 {
        struct isis_tx_queue_entry *e = THREAD_ARG(thread);
        struct isis_tx_queue *queue = e->queue;
 
-       thread_add_timer(master, tx_queue_send_event, e, 5, &e->retry);
+       event_add_timer(master, tx_queue_send_event, e, 5, &e->retry);
 
        if (e->is_retry)
                queue->circuit->area->lsp_rxmt_count++;
@@ -128,8 +114,6 @@ static int tx_queue_send_event(struct thread *thread)
 
        queue->send_event(queue->circuit, e->lsp, e->type);
        /* Don't access e here anymore, send_event might have destroyed it */
-
-       return 0;
 }
 
 void _isis_tx_queue_add(struct isis_tx_queue *queue,
@@ -163,8 +147,8 @@ void _isis_tx_queue_add(struct isis_tx_queue *queue,
 
        e->type = type;
 
-       thread_cancel(&(e->retry));
-       thread_add_event(master, tx_queue_send_event, e, 0, &e->retry);
+       THREAD_OFF(e->retry);
+       event_add_event(master, tx_queue_send_event, e, 0, &e->retry);
 
        e->is_retry = false;
 }
@@ -186,7 +170,7 @@ void _isis_tx_queue_del(struct isis_tx_queue *queue, struct isis_lsp *lsp,
                           func, file, line);
        }
 
-       thread_cancel(&(e->retry));
+       THREAD_OFF(e->retry);
 
        hash_release(queue->hash, e);
        XFREE(MTYPE_TX_QUEUE_ENTRY, e);