Use a single dedicated function for managing the lifecycle of a server (sync or async), with the control flow in that function managed entirely by futures.
This guarantees that lifecycle event callbacks only execute inside that single lifecycle management function, allowing for async callbacks to be executed in order without needing to resort to spawning new tasks.
This also generally simplifies the server implementation(s), drastically reducing the complexity of callbacks between server, OSC protocol and process prototol.
Use a single dedicated function for managing the lifecycle of a server (sync or async), with the control flow in that function managed entirely by futures.
This guarantees that lifecycle event callbacks only execute inside that single lifecycle management function, allowing for async callbacks to be executed in order without needing to resort to spawning new tasks.
This also generally simplifies the server implementation(s), drastically reducing the complexity of callbacks between server, OSC protocol and process prototol.