Fixed shutdown bugs
This commit is contained in:
parent
6bb7fb4c2e
commit
408a2e4cc3
1 changed files with 9 additions and 2 deletions
|
|
@ -596,6 +596,13 @@ class Nxbt():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if controller_index not in self.manager_state.keys():
|
if controller_index not in self.manager_state.keys():
|
||||||
|
if controller_index in self._controller_adapter_lookup.keys():
|
||||||
|
# Attempt to free any adapters claimed by a crashed controller
|
||||||
|
try:
|
||||||
|
adapter_path = self._controller_adapter_lookup.pop(controller_index, None)
|
||||||
|
self._adapters_in_use.pop(adapter_path, None)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
raise ValueError("Specified controller does not exist")
|
raise ValueError("Specified controller does not exist")
|
||||||
|
|
||||||
self._controller_lock.acquire()
|
self._controller_lock.acquire()
|
||||||
|
|
@ -773,7 +780,7 @@ class _ControllerManager():
|
||||||
|
|
||||||
def remove_controller(self, index):
|
def remove_controller(self, index):
|
||||||
|
|
||||||
self._children[index].kill()
|
self._children[index].terminate()
|
||||||
self.state.pop(index, None)
|
self.state.pop(index, None)
|
||||||
|
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue