improve handling of failed devices

This commit is contained in:
Jakob Ketterl 2021-12-06 15:50:03 +01:00
parent 9c28143dfb
commit 397155983d

View File

@ -77,8 +77,9 @@ class SpectrumThread(SdrSourceEventClient):
return return
self.dsp.stop() self.dsp.stop()
self.dsp = None self.dsp = None
self.reader.stop() if self.reader:
self.reader = None self.reader.stop()
self.reader = None
self.sdrSource.removeClient(self) self.sdrSource.removeClient(self)
while self.subscriptions: while self.subscriptions:
self.subscriptions.pop().cancel() self.subscriptions.pop().cancel()
@ -92,7 +93,8 @@ class SpectrumThread(SdrSourceEventClient):
def onStateChange(self, state: SdrSourceState): def onStateChange(self, state: SdrSourceState):
if state is SdrSourceState.STOPPING: if state is SdrSourceState.STOPPING:
self.dsp.stop() if self.dsp:
self.dsp.stop()
elif state == SdrSourceState.RUNNING: elif state == SdrSourceState.RUNNING:
if self.dsp is None: if self.dsp is None:
self.start() self.start()