Currrently. the handling of the UDP sockets in pyduro is not thread safe. sending two Frames to the same burner from two different threads will result in an Address already in use error in on of them.
I resorted to explicitly using a threading.Lock in my application to work around this: https://github.com/freol35241/aduro2mqtt/blob/main/main.py#L51
It would however be nicer f this feature was offered internally as part of pyduro instead. One possible solution would be to encapsulate the socket in a thread safe BurnerConnection class (internally using a threading.Lock). An instance of this class can then be passed to any Frame.send call instead of the connection details. This has the added benefit of reusing the socket for multiple calls rather than creating a new one for every call to Frame.send.
Currrently. the handling of the UDP sockets in pyduro is not thread safe.
sending twoFrames to the same burner from two different threads will result in anAddress already in useerror in on of them.I resorted to explicitly using a
threading.Lockin my application to work around this: https://github.com/freol35241/aduro2mqtt/blob/main/main.py#L51It would however be nicer f this feature was offered internally as part of pyduro instead. One possible solution would be to encapsulate the socket in a thread safe
BurnerConnectionclass (internally using athreading.Lock). An instance of this class can then be passed to anyFrame.sendcall instead of the connection details. This has the added benefit of reusing the socket for multiple calls rather than creating a new one for every call toFrame.send.