fix device failover (concurrent modification problem)

This commit is contained in:
Jakob Ketterl 2021-03-18 19:47:11 +01:00
parent b25a673829
commit 37e7331627

View File

@ -153,7 +153,7 @@ class SdrSource(ABC):
self.enabled = changes["enabled"] self.enabled = changes["enabled"]
else: else:
self.enabled = True self.enabled = True
for c in self.clients: for c in self.clients.copy():
if self.isEnabled(): if self.isEnabled():
c.onEnable() c.onEnable()
else: else:
@ -164,7 +164,7 @@ class SdrSource(ABC):
def fail(self): def fail(self):
self.failed = True self.failed = True
for c in self.clients: for c in self.clients.copy():
c.onFail() c.onFail()
def validateProfiles(self): def validateProfiles(self):
@ -420,14 +420,14 @@ class SdrSource(ABC):
if state == self.state: if state == self.state:
return return
self.state = state self.state = state
for c in self.clients: for c in self.clients.copy():
c.onStateChange(state) c.onStateChange(state)
def setBusyState(self, state: SdrBusyState): def setBusyState(self, state: SdrBusyState):
if state == self.busyState: if state == self.busyState:
return return
self.busyState = state self.busyState = state
for c in self.clients: for c in self.clients.copy():
c.onBusyStateChange(state) c.onBusyStateChange(state)