altos: Toggling telemetry monitoring would replay the telem queue
authorKeith Packard <keithp@keithp.com>
Wed, 18 Jul 2012 06:59:13 +0000 (23:59 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 18 Jul 2012 06:59:13 +0000 (23:59 -0700)
Using the 'm' command to turn telem off and back on would end up going
around the whole telemetry queue replaying everything there as the
wait loop would exit when disabling monitoring even if the ring was empty.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/core/ao_monitor.c

index d492e32a8424d312d104ba24772c1d1baeaff8aa..5876bef77d2b5848fbd1bc2bca18713fb781c4e6 100644 (file)
@@ -132,6 +132,8 @@ ao_monitor_put(void)
                        ao_sleep(DATA_TO_XDATA(&ao_external_monitoring));
                while (ao_monitor_tail == ao_monitor_head && ao_external_monitoring)
                        ao_sleep(DATA_TO_XDATA(&ao_monitor_head));
+               if (!ao_external_monitoring)
+                       continue;
                m = &ao_monitor_ring[ao_monitor_tail];
                ao_monitor_tail = ao_monitor_ring_next(ao_monitor_tail);
                switch (ao_monitoring) {