mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 01:37:53 +00:00
zebra: gracefully shutdown fpm module
Lets stop and free all resources before shutting down. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
6ba8db2186
commit
98a8750481
@ -1026,16 +1026,50 @@ static int fpm_nl_start(struct zebra_dplane_provider *prov)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int fpm_nl_finish_early(struct fpm_nl_ctx *fnc)
|
||||||
|
{
|
||||||
|
/* Disable all events and close socket. */
|
||||||
|
THREAD_OFF(fnc->t_ribreset);
|
||||||
|
THREAD_OFF(fnc->t_ribwalk);
|
||||||
|
THREAD_OFF(fnc->t_rmacreset);
|
||||||
|
THREAD_OFF(fnc->t_rmacwalk);
|
||||||
|
thread_cancel_async(fnc->fthread->master, &fnc->t_read, NULL);
|
||||||
|
thread_cancel_async(fnc->fthread->master, &fnc->t_write, NULL);
|
||||||
|
thread_cancel_async(fnc->fthread->master, &fnc->t_connect, NULL);
|
||||||
|
|
||||||
|
if (fnc->socket != -1) {
|
||||||
|
close(fnc->socket);
|
||||||
|
fnc->socket = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int fpm_nl_finish_late(struct fpm_nl_ctx *fnc)
|
||||||
|
{
|
||||||
|
/* Stop the running thread. */
|
||||||
|
frr_pthread_stop(fnc->fthread, NULL);
|
||||||
|
|
||||||
|
/* Free all allocated resources. */
|
||||||
|
pthread_mutex_destroy(&fnc->obuf_mutex);
|
||||||
|
pthread_mutex_destroy(&fnc->ctxqueue_mutex);
|
||||||
|
stream_free(fnc->ibuf);
|
||||||
|
stream_free(fnc->obuf);
|
||||||
|
free(gfnc);
|
||||||
|
gfnc = NULL;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int fpm_nl_finish(struct zebra_dplane_provider *prov, bool early)
|
static int fpm_nl_finish(struct zebra_dplane_provider *prov, bool early)
|
||||||
{
|
{
|
||||||
struct fpm_nl_ctx *fnc;
|
struct fpm_nl_ctx *fnc;
|
||||||
|
|
||||||
fnc = dplane_provider_get_data(prov);
|
fnc = dplane_provider_get_data(prov);
|
||||||
stream_free(fnc->ibuf);
|
if (early)
|
||||||
stream_free(fnc->obuf);
|
return fpm_nl_finish_early(fnc);
|
||||||
close(fnc->socket);
|
|
||||||
|
|
||||||
return 0;
|
return fpm_nl_finish_late(fnc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fpm_nl_process(struct zebra_dplane_provider *prov)
|
static int fpm_nl_process(struct zebra_dplane_provider *prov)
|
||||||
|
Loading…
Reference in New Issue
Block a user