diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2022-08-10 21:56:40 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2022-08-11 13:30:32 -0400 |
| commit | fb617d1874f817cde053560c8b13cff5d5ce1d12 (patch) | |
| tree | c6231022a9112d2d5fe83cb00363b6e6fa2c9d4c /ospfd/ospf_interface.c | |
| parent | 14fad76ce215c79152f0fa4bbc6a86af1d01fa26 (diff) | |
ospfd: Refactor fifo_flush for the interface
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'ospfd/ospf_interface.c')
| -rw-r--r-- | ospfd/ospf_interface.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index a4f4cd216a..2a758d5583 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -494,6 +494,20 @@ struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf, return match; } +void ospf_interface_fifo_flush(struct ospf_interface *oi) +{ + struct ospf *ospf = oi->ospf; + + ospf_fifo_flush(oi->obuf); + + if (oi->on_write_q) { + listnode_delete(ospf->oi_write_q, oi); + if (list_isempty(ospf->oi_write_q)) + THREAD_OFF(ospf->t_write); + oi->on_write_q = 0; + } +} + static void ospf_if_reset_stats(struct ospf_interface *oi) { oi->hello_in = oi->hello_out = 0; @@ -505,19 +519,10 @@ static void ospf_if_reset_stats(struct ospf_interface *oi) void ospf_if_stream_unset(struct ospf_interface *oi) { - struct ospf *ospf = oi->ospf; - /* flush the interface packet queue */ - ospf_fifo_flush(oi->obuf); + ospf_interface_fifo_flush(oi); /*reset protocol stats */ ospf_if_reset_stats(oi); - - if (oi->on_write_q) { - listnode_delete(ospf->oi_write_q, oi); - if (list_isempty(ospf->oi_write_q)) - THREAD_OFF(ospf->t_write); - oi->on_write_q = 0; - } } |
