]> git.proxmox.com Git - mirror_frr.git/commitdiff
[snmp-smux] Fix problems if 'smux peer ...' is issued multiple times
authorPaul Jakma <paul.jakma@sun.com>
Mon, 22 Oct 2007 15:53:17 +0000 (15:53 +0000)
committerPaul Jakma <paul.jakma@sun.com>
Mon, 22 Oct 2007 15:53:17 +0000 (15:53 +0000)
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.

lib/ChangeLog
lib/smux.c

index 887c7854591ca84ea41c71c62be4ba455c434c76..0725f795c1ed093d09494d1351a8a236299f285e 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2007-10-04 Denis Ovsienko
 
        * pid_output.c: (pid_output) stop using LOGFILE_MASK
index 8218c44081e44c907c10e369ba1dc3b49d607a08..6285c94df5e673f635e1a03ed88c8e2dc2dc7875 100644 (file)
@@ -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);
 }