diff options
author | Donald Sharp <sharpd@nvidia.com> | 2022-05-17 22:29:29 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@nvidia.com> | 2022-05-20 15:52:16 +0200 |
commit | c905f04c7ce7b09189999d4908c379f880b6b179 (patch) | |
tree | 28d5769ebac08b41f3410ca7ecc4c7138b15500a /ospf6d/ospf6_interface.c | |
parent | ospf6d: Remove double check of default prefix (diff) | |
download | frr-c905f04c7ce7b09189999d4908c379f880b6b179.tar.xz frr-c905f04c7ce7b09189999d4908c379f880b6b179.zip |
ospf6d: Clean up thread interface
a) Remove setting of thread pointer to NULL after
thread invocation, this is already done.
b) Use thread_is_scheduled()
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'ospf6d/ospf6_interface.c')
-rw-r--r-- | ospf6d/ospf6_interface.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index c58bb3a0f..2a503c623 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1152,7 +1152,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, if (use_json) { timerclear(&res); - if (oi->thread_send_lsupdate) + if (thread_is_scheduled(oi->thread_send_lsupdate)) timersub(&oi->thread_send_lsupdate->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); @@ -1162,7 +1162,9 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, duration); json_object_string_add( json_obj, "lsUpdateSendThread", - (oi->thread_send_lsupdate ? "on" : "off")); + (thread_is_scheduled(oi->thread_send_lsupdate) + ? "on" + : "off")); json_arr = json_object_new_array(); for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext)) @@ -1172,7 +1174,7 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, json_arr); timerclear(&res); - if (oi->thread_send_lsack) + if (thread_is_scheduled(oi->thread_send_lsack)) timersub(&oi->thread_send_lsack->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); @@ -1180,8 +1182,10 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, oi->lsack_list->count); json_object_string_add(json_obj, "pendingLsaLsAckTime", duration); - json_object_string_add(json_obj, "lsAckSendThread", - (oi->thread_send_lsack ? "on" : "off")); + json_object_string_add( + json_obj, "lsAckSendThread", + (thread_is_scheduled(oi->thread_send_lsack) ? "on" + : "off")); json_arr = json_object_new_array(); for (ALL_LSDB(oi->lsack_list, lsa, lsanext)) @@ -1191,25 +1195,28 @@ static int ospf6_interface_show(struct vty *vty, struct interface *ifp, } else { timerclear(&res); - if (oi->thread_send_lsupdate) + if (thread_is_scheduled(oi->thread_send_lsupdate)) timersub(&oi->thread_send_lsupdate->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); vty_out(vty, " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n", oi->lsupdate_list->count, duration, - (oi->thread_send_lsupdate ? "on" : "off")); + (thread_is_scheduled(oi->thread_send_lsupdate) + ? "on" + : "off")); for (ALL_LSDB(oi->lsupdate_list, lsa, lsanext)) vty_out(vty, " %s\n", lsa->name); timerclear(&res); - if (oi->thread_send_lsack) + if (thread_is_scheduled(oi->thread_send_lsack)) timersub(&oi->thread_send_lsack->u.sands, &now, &res); timerstring(&res, duration, sizeof(duration)); vty_out(vty, " %d Pending LSAs for LSAck in Time %s [thread %s]\n", oi->lsack_list->count, duration, - (oi->thread_send_lsack ? "on" : "off")); + (thread_is_scheduled(oi->thread_send_lsack) ? "on" + : "off")); for (ALL_LSDB(oi->lsack_list, lsa, lsanext)) vty_out(vty, " %s\n", lsa->name); } |