From 88ec861fb76962853aca17b65a30c33bcc22c05a Mon Sep 17 00:00:00 2001 From: Joseph Poirier Date: Fri, 6 Nov 2015 21:57:59 -0600 Subject: [PATCH] put back Devices assignment, change type for atomic store --- main/gen_gdl90.go | 4 ++-- main/sdr.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main/gen_gdl90.go b/main/gen_gdl90.go index 32ee8d81..3b969e13 100644 --- a/main/gen_gdl90.go +++ b/main/gen_gdl90.go @@ -455,7 +455,7 @@ func cpuTempMonitor() { globalStatus.CPUTemp = float32(tInt) // case where Temp is returned as simple integer } } - } + } } } @@ -708,7 +708,7 @@ type settings struct { type status struct { Version string - Devices uint + Devices uint32 Connected_Users uint UAT_messages_last_minute uint uat_products_last_minute map[string]uint32 diff --git a/main/sdr.go b/main/sdr.go index 9ac14367..09b92fbc 100644 --- a/main/sdr.go +++ b/main/sdr.go @@ -6,6 +6,7 @@ import ( "strconv" "strings" "sync" + "sync/atomic" "time" "../godump978" @@ -228,6 +229,7 @@ func sdrWatcher() { for { time.Sleep(1 * time.Second) count := rtl.GetDeviceCount() + atomic.StoreUint32(&globalStatus.Devices, uint32(count)) log.Println("DeviceCount...", count) // support two and only two dongles