kbalt / ezk

EZK is a collection of Rust crates to build SIP applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to unbind transport programmatically?

constlhq opened this issue · comments

Hi, help wanted. Once the Transport has been created by sip_core::transport::udp::Udp::spawn(...) function, how to unbind it manually, or how to make it handle the SIGTERM signal (which is equivalent to the kill -15 command) , I noticed in the fn receive_task(...) function there is a free loop, so it's not possible to drop the inner in the Udp::spawn() function.
The scenario is when user change the configuration, like sip port , my service should rebind the port setting by user. Off cause I can add a channel between my code and the transport , but I dont want to hack the crate, could you give some advice? Thanks in advance!

commented

Hi,

Sorry to disappoint, but its currently not possible to remove or add transports after building the Endpoint.

I do have plans to add support for modification of transports and factories during runtime, but have to find the time to work on it.

That's all right. Thanks for making such an awesome crate. My current project can't work without this feature, so I cloned your code then I inject a broadcast rx to receive the shutdown message and drop the ref into each thread that holding the refrence of Endpoint, when the reference count reduces to one, I drop the Arc and then start a new one. It works fine, but still looking forward to official support.