This PR adds support for opening new servers when all slots are filled.
handle_devices is moved to a separate thread started by main instead of being started by UDPServer, allowing multiple instances of UDPServer.
handle_devices is responsible for starting new servers and adding new devices to a server with a free slot.
I don't actually have five devices to test it, I caused the slots to fill up by adding self.slots[i+1] = self.slots[i] to UDPServer.add_device after creating the new SwitchDevice, doubling the number of taken slots.
Note:
I removed the try clause in handle_devices, as it often caused the thread to loop infinitely when an error occured. In case of error, we should let the thread to simply fail.
I also fixed an error when detecting already assigned devices (I noticed a false-positive during a temporary state of a new combined device). It's hard to notice in all the diff.
This PR adds support for opening new servers when all slots are filled.
handle_devices
is moved to a separate thread started bymain
instead of being started byUDPServer
, allowing multiple instances ofUDPServer
.handle_devices
is responsible for starting new servers and adding new devices to a server with a free slot.I don't actually have five devices to test it, I caused the slots to fill up by adding
self.slots[i+1] = self.slots[i]
toUDPServer.add_device
after creating the newSwitchDevice
, doubling the number of taken slots.Note:
handle_devices
, as it often caused the thread to loop infinitely when an error occured. In case of error, we should let the thread to simply fail.