summaryrefslogtreecommitdiffstats
path: root/lib/smux.c
diff options
context:
space:
mode:
authorPaul Jakma <paul.jakma@sun.com>2007-10-22 17:53:17 +0200
committerPaul Jakma <paul.jakma@sun.com>2007-10-22 17:53:17 +0200
commita56ef88348be9f019631d6bc92801aae647be05b (patch)
tree12051517321d29fda1116654af59fab501c5b217 /lib/smux.c
parent[news] Fix top-line version (diff)
downloadfrr-a56ef88348be9f019631d6bc92801aae647be05b.tar.xz
frr-a56ef88348be9f019631d6bc92801aae647be05b.zip
[snmp-smux] Fix problems if 'smux peer ...' is issued multiple times
2007-10-22 Lorenzo Colitti <lorenzo@colitti.com> * smux.c: (smux_stop) Avoid cancelling a defunct thread pointer (smux_start) Stop smux before trying to start it, possibly again.
Diffstat (limited to 'lib/smux.c')
-rw-r--r--lib/smux.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/smux.c b/lib/smux.c
index 8218c4408..6285c94df 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);
}