Skip to content

Feature suggestion: Thread safety #10

Description

@freol35241

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions