fully initialize sdr devices

* makes always-on work as expected
* prevents race conditions when multiple clients connect at the same
  time
This commit is contained in:
Jakob Ketterl 2020-12-10 18:28:10 +01:00
parent 2c04d40c53
commit 05096c2a16
2 changed files with 4 additions and 4 deletions

View File

@ -56,7 +56,8 @@ Support and info: https://groups.io/g/openwebrx
return return
# Get error messages about unknown / unavailable features as soon as possible # Get error messages about unknown / unavailable features as soon as possible
SdrService.loadProps() # start up "always-on" sources right away
SdrService.getSources()
Services.start() Services.start()

View File

@ -13,7 +13,7 @@ class SdrService(object):
lastPort = None lastPort = None
@staticmethod @staticmethod
def loadProps(): def _loadProps():
if SdrService.sdrProps is None: if SdrService.sdrProps is None:
pm = Config.get() pm = Config.get()
featureDetector = FeatureDetector() featureDetector = FeatureDetector()
@ -60,7 +60,6 @@ class SdrService(object):
@staticmethod @staticmethod
def getSource(id): def getSource(id):
SdrService.loadProps()
sources = SdrService.getSources() sources = SdrService.getSources()
if not sources: if not sources:
return None return None
@ -70,7 +69,7 @@ class SdrService(object):
@staticmethod @staticmethod
def getSources(): def getSources():
SdrService.loadProps() SdrService._loadProps()
for id in SdrService.sdrProps.keys(): for id in SdrService.sdrProps.keys():
if not id in SdrService.sources: if not id in SdrService.sources:
props = SdrService.sdrProps[id] props = SdrService.sdrProps[id]