From: Paul Jakma Date: Mon, 22 Oct 2007 15:53:17 +0000 (+0000) Subject: [snmp-smux] Fix problems if 'smux peer ...' is issued multiple times X-Git-Tag: frr-2.0-rc1~2453 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=a56ef88348be9f019631d6bc92801aae647be05b;p=mirror%2Ffrr.git [snmp-smux] Fix problems if 'smux peer ...' is issued multiple times 2007-10-22 Lorenzo Colitti * smux.c: (smux_stop) Avoid cancelling a defunct thread pointer (smux_start) Stop smux before trying to start it, possibly again. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index 887c785459..0725f795c1 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2007-10-22 Lorenzo Colitti + + * smux.c: (smux_stop) Avoid cancelling a defunct thread pointer + (smux_start) Stop smux before trying to start it, possibly again. + 2007-10-04 Denis Ovsienko * pid_output.c: (pid_output) stop using LOGFILE_MASK diff --git a/lib/smux.c b/lib/smux.c index 8218c44081..6285c94df5 100644 --- a/lib/smux.c +++ b/lib/smux.c @@ -1228,9 +1228,16 @@ void smux_stop () { if (smux_read_thread) - thread_cancel (smux_read_thread); + { + thread_cancel (smux_read_thread); + smux_read_thread = NULL; + } + if (smux_connect_thread) - thread_cancel (smux_connect_thread); + { + thread_cancel (smux_connect_thread); + smux_connect_thread = NULL; + } if (smux_sock >= 0) { @@ -1534,6 +1541,9 @@ smux_init (struct thread_master *tm) void smux_start(void) { + /* Close any existing connections. */ + smux_stop(); + /* Schedule first connection. */ smux_event (SMUX_SCHEDULE, 0); }