joaorb64 / joycond-cemuhook

Support for cemuhook's UDP protocol for joycond devices
MIT License
143 stars 18 forks source link

Add support for multiple servers #35

Closed gal20 closed 3 years ago

gal20 commented 3 years ago

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:

joaorb64 commented 3 years ago

Wow, this is insane! Awesome job!