fix some issues in multi-user operation
This commit is contained in:
parent
dd3a970497
commit
1108cd9a96
@ -231,9 +231,12 @@ class SpectrumThread(object):
|
|||||||
self.doRun = False
|
self.doRun = False
|
||||||
self.sdrSource = sdrSource
|
self.sdrSource = sdrSource
|
||||||
self.sdrSource.addClient(self)
|
self.sdrSource.addClient(self)
|
||||||
|
self.thread = None
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
threading.Thread(target = self.run).start()
|
if self.thread is None:
|
||||||
|
self.thread = threading.Thread(target = self.run)
|
||||||
|
self.thread.start()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
props = self.sdrSource.props.collect(
|
props = self.sdrSource.props.collect(
|
||||||
@ -275,10 +278,16 @@ class SpectrumThread(object):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
else:
|
else:
|
||||||
for c in self.clients:
|
for c in self.clients:
|
||||||
c.write_spectrum_data(data)
|
try:
|
||||||
|
c.write_spectrum_data(data)
|
||||||
|
except OSError:
|
||||||
|
self.remove_client(c)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
dsp.stop()
|
dsp.stop()
|
||||||
print("spectrum thread shut down")
|
print("spectrum thread shut down")
|
||||||
|
self.thread = None
|
||||||
|
|
||||||
def add_client(self, c):
|
def add_client(self, c):
|
||||||
self.clients.append(c)
|
self.clients.append(c)
|
||||||
|
Loading…
Reference in New Issue
Block a user