mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-14 20:12:31 +00:00
ldpd: Convert thread_cancel to THREAD_OFF
Just convert all uses of thread_cancel to THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
fa935aa7e8
commit
2783a6921c
@ -72,7 +72,7 @@ accept_del(int fd)
|
|||||||
LIST_FOREACH(av, &accept_queue.queue, entry)
|
LIST_FOREACH(av, &accept_queue.queue, entry)
|
||||||
if (av->fd == fd) {
|
if (av->fd == fd) {
|
||||||
log_debug("%s: %d removed from queue", __func__, fd);
|
log_debug("%s: %d removed from queue", __func__, fd);
|
||||||
thread_cancel(&av->ev);
|
THREAD_OFF(av->ev);
|
||||||
LIST_REMOVE(av, entry);
|
LIST_REMOVE(av, entry);
|
||||||
free(av);
|
free(av);
|
||||||
return;
|
return;
|
||||||
@ -92,7 +92,7 @@ accept_unpause(void)
|
|||||||
{
|
{
|
||||||
if (accept_queue.evt != NULL) {
|
if (accept_queue.evt != NULL) {
|
||||||
log_debug(__func__);
|
log_debug(__func__);
|
||||||
thread_cancel(&accept_queue.evt);
|
THREAD_OFF(accept_queue.evt);
|
||||||
accept_arm();
|
accept_arm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ accept_unarm(void)
|
|||||||
{
|
{
|
||||||
struct accept_ev *av;
|
struct accept_ev *av;
|
||||||
LIST_FOREACH(av, &accept_queue.queue, entry)
|
LIST_FOREACH(av, &accept_queue.queue, entry)
|
||||||
thread_cancel(&av->ev);
|
THREAD_OFF(av->ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void accept_cb(struct thread *thread)
|
static void accept_cb(struct thread *thread)
|
||||||
|
@ -196,7 +196,7 @@ static void adj_itimer(struct thread *thread)
|
|||||||
void
|
void
|
||||||
adj_start_itimer(struct adj *adj)
|
adj_start_itimer(struct adj *adj)
|
||||||
{
|
{
|
||||||
thread_cancel(&adj->inactivity_timer);
|
THREAD_OFF(adj->inactivity_timer);
|
||||||
adj->inactivity_timer = NULL;
|
adj->inactivity_timer = NULL;
|
||||||
thread_add_timer(master, adj_itimer, adj, adj->holdtime,
|
thread_add_timer(master, adj_itimer, adj, adj->holdtime,
|
||||||
&adj->inactivity_timer);
|
&adj->inactivity_timer);
|
||||||
@ -205,7 +205,7 @@ adj_start_itimer(struct adj *adj)
|
|||||||
void
|
void
|
||||||
adj_stop_itimer(struct adj *adj)
|
adj_stop_itimer(struct adj *adj)
|
||||||
{
|
{
|
||||||
thread_cancel(&adj->inactivity_timer);
|
THREAD_OFF(adj->inactivity_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* targeted neighbors */
|
/* targeted neighbors */
|
||||||
@ -354,7 +354,7 @@ static void tnbr_hello_timer(struct thread *thread)
|
|||||||
static void
|
static void
|
||||||
tnbr_start_hello_timer(struct tnbr *tnbr)
|
tnbr_start_hello_timer(struct tnbr *tnbr)
|
||||||
{
|
{
|
||||||
thread_cancel(&tnbr->hello_timer);
|
THREAD_OFF(tnbr->hello_timer);
|
||||||
tnbr->hello_timer = NULL;
|
tnbr->hello_timer = NULL;
|
||||||
thread_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr),
|
thread_add_timer(master, tnbr_hello_timer, tnbr, tnbr_get_hello_interval(tnbr),
|
||||||
&tnbr->hello_timer);
|
&tnbr->hello_timer);
|
||||||
@ -363,7 +363,7 @@ tnbr_start_hello_timer(struct tnbr *tnbr)
|
|||||||
static void
|
static void
|
||||||
tnbr_stop_hello_timer(struct tnbr *tnbr)
|
tnbr_stop_hello_timer(struct tnbr *tnbr)
|
||||||
{
|
{
|
||||||
thread_cancel(&tnbr->hello_timer);
|
THREAD_OFF(tnbr->hello_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ctl_adj *
|
struct ctl_adj *
|
||||||
|
@ -180,8 +180,8 @@ control_close(int fd)
|
|||||||
msgbuf_clear(&c->iev.ibuf.w);
|
msgbuf_clear(&c->iev.ibuf.w);
|
||||||
TAILQ_REMOVE(&ctl_conns, c, entry);
|
TAILQ_REMOVE(&ctl_conns, c, entry);
|
||||||
|
|
||||||
thread_cancel(&c->iev.ev_read);
|
THREAD_OFF(c->iev.ev_read);
|
||||||
thread_cancel(&c->iev.ev_write);
|
THREAD_OFF(c->iev.ev_write);
|
||||||
close(c->iev.ibuf.fd);
|
close(c->iev.ibuf.fd);
|
||||||
accept_unpause();
|
accept_unpause();
|
||||||
free(c);
|
free(c);
|
||||||
|
@ -467,7 +467,7 @@ static void if_hello_timer(struct thread *thread)
|
|||||||
static void
|
static void
|
||||||
if_start_hello_timer(struct iface_af *ia)
|
if_start_hello_timer(struct iface_af *ia)
|
||||||
{
|
{
|
||||||
thread_cancel(&ia->hello_timer);
|
THREAD_OFF(ia->hello_timer);
|
||||||
thread_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia),
|
thread_add_timer(master, if_hello_timer, ia, if_get_hello_interval(ia),
|
||||||
&ia->hello_timer);
|
&ia->hello_timer);
|
||||||
}
|
}
|
||||||
@ -475,7 +475,7 @@ if_start_hello_timer(struct iface_af *ia)
|
|||||||
static void
|
static void
|
||||||
if_stop_hello_timer(struct iface_af *ia)
|
if_stop_hello_timer(struct iface_af *ia)
|
||||||
{
|
{
|
||||||
thread_cancel(&ia->hello_timer);
|
THREAD_OFF(ia->hello_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ctl_iface *
|
struct ctl_iface *
|
||||||
|
@ -417,8 +417,8 @@ static void lde_dispatch_imsg(struct thread *thread)
|
|||||||
imsg_event_add(iev);
|
imsg_event_add(iev);
|
||||||
else {
|
else {
|
||||||
/* this pipe is dead, so remove the event handlers and exit */
|
/* this pipe is dead, so remove the event handlers and exit */
|
||||||
thread_cancel(&iev->ev_read);
|
THREAD_OFF(iev->ev_read);
|
||||||
thread_cancel(&iev->ev_write);
|
THREAD_OFF(iev->ev_write);
|
||||||
lde_shutdown();
|
lde_shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -702,8 +702,8 @@ static void lde_dispatch_parent(struct thread *thread)
|
|||||||
imsg_event_add(iev);
|
imsg_event_add(iev);
|
||||||
else {
|
else {
|
||||||
/* this pipe is dead, so remove the event handlers and exit */
|
/* this pipe is dead, so remove the event handlers and exit */
|
||||||
thread_cancel(&iev->ev_read);
|
THREAD_OFF(iev->ev_read);
|
||||||
thread_cancel(&iev->ev_write);
|
THREAD_OFF(iev->ev_write);
|
||||||
lde_shutdown();
|
lde_shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1068,7 +1068,7 @@ void lde_gc_timer(struct thread *thread)
|
|||||||
void
|
void
|
||||||
lde_gc_start_timer(void)
|
lde_gc_start_timer(void)
|
||||||
{
|
{
|
||||||
thread_cancel(&gc_timer);
|
THREAD_OFF(gc_timer);
|
||||||
thread_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL,
|
thread_add_timer(master, lde_gc_timer, NULL, LDE_GC_INTERVAL,
|
||||||
&gc_timer);
|
&gc_timer);
|
||||||
}
|
}
|
||||||
@ -1076,5 +1076,5 @@ lde_gc_start_timer(void)
|
|||||||
void
|
void
|
||||||
lde_gc_stop_timer(void)
|
lde_gc_stop_timer(void)
|
||||||
{
|
{
|
||||||
thread_cancel(&gc_timer);
|
THREAD_OFF(gc_timer);
|
||||||
}
|
}
|
||||||
|
14
ldpd/ldpd.c
14
ldpd/ldpd.c
@ -616,8 +616,8 @@ static void main_dispatch_ldpe(struct thread *thread)
|
|||||||
imsg_event_add(iev);
|
imsg_event_add(iev);
|
||||||
else {
|
else {
|
||||||
/* this pipe is dead, so remove the event handlers and exit */
|
/* this pipe is dead, so remove the event handlers and exit */
|
||||||
thread_cancel(&iev->ev_read);
|
THREAD_OFF(iev->ev_read);
|
||||||
thread_cancel(&iev->ev_write);
|
THREAD_OFF(iev->ev_write);
|
||||||
ldpe_pid = 0;
|
ldpe_pid = 0;
|
||||||
if (lde_pid == 0)
|
if (lde_pid == 0)
|
||||||
ldpd_shutdown();
|
ldpd_shutdown();
|
||||||
@ -721,8 +721,8 @@ static void main_dispatch_lde(struct thread *thread)
|
|||||||
imsg_event_add(iev);
|
imsg_event_add(iev);
|
||||||
else {
|
else {
|
||||||
/* this pipe is dead, so remove the event handlers and exit */
|
/* this pipe is dead, so remove the event handlers and exit */
|
||||||
thread_cancel(&iev->ev_read);
|
THREAD_OFF(iev->ev_read);
|
||||||
thread_cancel(&iev->ev_write);
|
THREAD_OFF(iev->ev_write);
|
||||||
lde_pid = 0;
|
lde_pid = 0;
|
||||||
if (ldpe_pid == 0)
|
if (ldpe_pid == 0)
|
||||||
ldpd_shutdown();
|
ldpd_shutdown();
|
||||||
@ -744,8 +744,8 @@ void ldp_write_handler(struct thread *thread)
|
|||||||
fatal("msgbuf_write");
|
fatal("msgbuf_write");
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
/* this pipe is dead, so remove the event handlers */
|
/* this pipe is dead, so remove the event handlers */
|
||||||
thread_cancel(&iev->ev_read);
|
THREAD_OFF(iev->ev_read);
|
||||||
thread_cancel(&iev->ev_write);
|
THREAD_OFF(iev->ev_write);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -829,7 +829,7 @@ void evbuf_init(struct evbuf *eb, int fd, void (*handler)(struct thread *),
|
|||||||
void
|
void
|
||||||
evbuf_clear(struct evbuf *eb)
|
evbuf_clear(struct evbuf *eb)
|
||||||
{
|
{
|
||||||
thread_cancel(&eb->ev);
|
THREAD_OFF(eb->ev);
|
||||||
msgbuf_clear(&eb->wbuf);
|
msgbuf_clear(&eb->wbuf);
|
||||||
eb->wbuf.fd = -1;
|
eb->wbuf.fd = -1;
|
||||||
}
|
}
|
||||||
|
14
ldpd/ldpe.c
14
ldpd/ldpe.c
@ -212,7 +212,7 @@ ldpe_shutdown(void)
|
|||||||
|
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
if (sysdep.no_pfkey == 0) {
|
if (sysdep.no_pfkey == 0) {
|
||||||
thread_cancel(&pfkey_ev);
|
THREAD_OFF(pfkey_ev);
|
||||||
close(global.pfkeysock);
|
close(global.pfkeysock);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -626,8 +626,8 @@ static void ldpe_dispatch_main(struct thread *thread)
|
|||||||
imsg_event_add(iev);
|
imsg_event_add(iev);
|
||||||
else {
|
else {
|
||||||
/* this pipe is dead, so remove the event handlers and exit */
|
/* this pipe is dead, so remove the event handlers and exit */
|
||||||
thread_cancel(&iev->ev_read);
|
THREAD_OFF(iev->ev_read);
|
||||||
thread_cancel(&iev->ev_write);
|
THREAD_OFF(iev->ev_write);
|
||||||
ldpe_shutdown();
|
ldpe_shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -762,8 +762,8 @@ static void ldpe_dispatch_lde(struct thread *thread)
|
|||||||
imsg_event_add(iev);
|
imsg_event_add(iev);
|
||||||
else {
|
else {
|
||||||
/* this pipe is dead, so remove the event handlers and exit */
|
/* this pipe is dead, so remove the event handlers and exit */
|
||||||
thread_cancel(&iev->ev_read);
|
THREAD_OFF(iev->ev_read);
|
||||||
thread_cancel(&iev->ev_write);
|
THREAD_OFF(iev->ev_write);
|
||||||
ldpe_shutdown();
|
ldpe_shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -813,14 +813,14 @@ ldpe_close_sockets(int af)
|
|||||||
af_global = ldp_af_global_get(&global, af);
|
af_global = ldp_af_global_get(&global, af);
|
||||||
|
|
||||||
/* discovery socket */
|
/* discovery socket */
|
||||||
thread_cancel(&af_global->disc_ev);
|
THREAD_OFF(af_global->disc_ev);
|
||||||
if (af_global->ldp_disc_socket != -1) {
|
if (af_global->ldp_disc_socket != -1) {
|
||||||
close(af_global->ldp_disc_socket);
|
close(af_global->ldp_disc_socket);
|
||||||
af_global->ldp_disc_socket = -1;
|
af_global->ldp_disc_socket = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* extended discovery socket */
|
/* extended discovery socket */
|
||||||
thread_cancel(&af_global->edisc_ev);
|
THREAD_OFF(af_global->edisc_ev);
|
||||||
if (af_global->ldp_edisc_socket != -1) {
|
if (af_global->ldp_edisc_socket != -1) {
|
||||||
close(af_global->ldp_edisc_socket);
|
close(af_global->ldp_edisc_socket);
|
||||||
af_global->ldp_edisc_socket = -1;
|
af_global->ldp_edisc_socket = -1;
|
||||||
|
@ -307,7 +307,7 @@ nbr_del(struct nbr *nbr)
|
|||||||
nbr->auth.method = AUTH_NONE;
|
nbr->auth.method = AUTH_NONE;
|
||||||
|
|
||||||
if (nbr_pending_connect(nbr))
|
if (nbr_pending_connect(nbr))
|
||||||
thread_cancel(&nbr->ev_connect);
|
THREAD_OFF(nbr->ev_connect);
|
||||||
nbr_stop_ktimer(nbr);
|
nbr_stop_ktimer(nbr);
|
||||||
nbr_stop_ktimeout(nbr);
|
nbr_stop_ktimeout(nbr);
|
||||||
nbr_stop_itimeout(nbr);
|
nbr_stop_itimeout(nbr);
|
||||||
@ -435,7 +435,7 @@ nbr_start_ktimer(struct nbr *nbr)
|
|||||||
|
|
||||||
/* send three keepalives per period */
|
/* send three keepalives per period */
|
||||||
secs = nbr->keepalive / KEEPALIVE_PER_PERIOD;
|
secs = nbr->keepalive / KEEPALIVE_PER_PERIOD;
|
||||||
thread_cancel(&nbr->keepalive_timer);
|
THREAD_OFF(nbr->keepalive_timer);
|
||||||
nbr->keepalive_timer = NULL;
|
nbr->keepalive_timer = NULL;
|
||||||
thread_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer);
|
thread_add_timer(master, nbr_ktimer, nbr, secs, &nbr->keepalive_timer);
|
||||||
}
|
}
|
||||||
@ -443,7 +443,7 @@ nbr_start_ktimer(struct nbr *nbr)
|
|||||||
void
|
void
|
||||||
nbr_stop_ktimer(struct nbr *nbr)
|
nbr_stop_ktimer(struct nbr *nbr)
|
||||||
{
|
{
|
||||||
thread_cancel(&nbr->keepalive_timer);
|
THREAD_OFF(nbr->keepalive_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keepalive timeout: if the nbr hasn't sent keepalive */
|
/* Keepalive timeout: if the nbr hasn't sent keepalive */
|
||||||
@ -462,7 +462,7 @@ static void nbr_ktimeout(struct thread *thread)
|
|||||||
static void
|
static void
|
||||||
nbr_start_ktimeout(struct nbr *nbr)
|
nbr_start_ktimeout(struct nbr *nbr)
|
||||||
{
|
{
|
||||||
thread_cancel(&nbr->keepalive_timeout);
|
THREAD_OFF(nbr->keepalive_timeout);
|
||||||
nbr->keepalive_timeout = NULL;
|
nbr->keepalive_timeout = NULL;
|
||||||
thread_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive,
|
thread_add_timer(master, nbr_ktimeout, nbr, nbr->keepalive,
|
||||||
&nbr->keepalive_timeout);
|
&nbr->keepalive_timeout);
|
||||||
@ -471,7 +471,7 @@ nbr_start_ktimeout(struct nbr *nbr)
|
|||||||
void
|
void
|
||||||
nbr_stop_ktimeout(struct nbr *nbr)
|
nbr_stop_ktimeout(struct nbr *nbr)
|
||||||
{
|
{
|
||||||
thread_cancel(&nbr->keepalive_timeout);
|
THREAD_OFF(nbr->keepalive_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Session initialization timeout: if nbr got stuck in the initialization FSM */
|
/* Session initialization timeout: if nbr got stuck in the initialization FSM */
|
||||||
@ -491,7 +491,7 @@ nbr_start_itimeout(struct nbr *nbr)
|
|||||||
int secs;
|
int secs;
|
||||||
|
|
||||||
secs = INIT_FSM_TIMEOUT;
|
secs = INIT_FSM_TIMEOUT;
|
||||||
thread_cancel(&nbr->init_timeout);
|
THREAD_OFF(nbr->init_timeout);
|
||||||
nbr->init_timeout = NULL;
|
nbr->init_timeout = NULL;
|
||||||
thread_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout);
|
thread_add_timer(master, nbr_itimeout, nbr, secs, &nbr->init_timeout);
|
||||||
}
|
}
|
||||||
@ -499,7 +499,7 @@ nbr_start_itimeout(struct nbr *nbr)
|
|||||||
void
|
void
|
||||||
nbr_stop_itimeout(struct nbr *nbr)
|
nbr_stop_itimeout(struct nbr *nbr)
|
||||||
{
|
{
|
||||||
thread_cancel(&nbr->init_timeout);
|
THREAD_OFF(nbr->init_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Init delay timer: timer to retry to iniziatize session */
|
/* Init delay timer: timer to retry to iniziatize session */
|
||||||
@ -537,7 +537,7 @@ nbr_start_idtimer(struct nbr *nbr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread_cancel(&nbr->initdelay_timer);
|
THREAD_OFF(nbr->initdelay_timer);
|
||||||
nbr->initdelay_timer = NULL;
|
nbr->initdelay_timer = NULL;
|
||||||
thread_add_timer(master, nbr_idtimer, nbr, secs,
|
thread_add_timer(master, nbr_idtimer, nbr, secs,
|
||||||
&nbr->initdelay_timer);
|
&nbr->initdelay_timer);
|
||||||
@ -546,7 +546,7 @@ nbr_start_idtimer(struct nbr *nbr)
|
|||||||
void
|
void
|
||||||
nbr_stop_idtimer(struct nbr *nbr)
|
nbr_stop_idtimer(struct nbr *nbr)
|
||||||
{
|
{
|
||||||
thread_cancel(&nbr->initdelay_timer);
|
THREAD_OFF(nbr->initdelay_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -651,7 +651,7 @@ session_shutdown(struct nbr *nbr, uint32_t status, uint32_t msg_id,
|
|||||||
switch (nbr->state) {
|
switch (nbr->state) {
|
||||||
case NBR_STA_PRESENT:
|
case NBR_STA_PRESENT:
|
||||||
if (nbr_pending_connect(nbr))
|
if (nbr_pending_connect(nbr))
|
||||||
thread_cancel(&nbr->ev_connect);
|
THREAD_OFF(nbr->ev_connect);
|
||||||
break;
|
break;
|
||||||
case NBR_STA_INITIAL:
|
case NBR_STA_INITIAL:
|
||||||
case NBR_STA_OPENREC:
|
case NBR_STA_OPENREC:
|
||||||
@ -756,7 +756,7 @@ tcp_close(struct tcp_conn *tcp)
|
|||||||
evbuf_clear(&tcp->wbuf);
|
evbuf_clear(&tcp->wbuf);
|
||||||
|
|
||||||
if (tcp->nbr) {
|
if (tcp->nbr) {
|
||||||
thread_cancel(&tcp->rev);
|
THREAD_OFF(tcp->rev);
|
||||||
free(tcp->rbuf);
|
free(tcp->rbuf);
|
||||||
tcp->nbr->tcp = NULL;
|
tcp->nbr->tcp = NULL;
|
||||||
}
|
}
|
||||||
@ -788,7 +788,7 @@ pending_conn_new(int fd, int af, union ldpd_addr *addr)
|
|||||||
void
|
void
|
||||||
pending_conn_del(struct pending_conn *pconn)
|
pending_conn_del(struct pending_conn *pconn)
|
||||||
{
|
{
|
||||||
thread_cancel(&pconn->ev_timeout);
|
THREAD_OFF(pconn->ev_timeout);
|
||||||
TAILQ_REMOVE(&global.pending_conns, pconn, entry);
|
TAILQ_REMOVE(&global.pending_conns, pconn, entry);
|
||||||
free(pconn);
|
free(pconn);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user