[erlang-questions] terminate supervisor from it's child process
Vance Shipley
vances@REDACTED
Thu Feb 14 07:53:09 CET 2019
On Thu, Feb 14, 2019 at 11:52 AM block.rxckin.beats@REDACTED
<block.rxckin.beats@REDACTED> wrote:
> I'm writing udp server with supervision tree like below.
...
> (s1for1) (1for1)
> server_sup - udp_sup - |- udp_worker
> |- dtls_worker
> |- stun_worker
> |- srtp_worker
> is there any way to terminate supervisor from it's child process ?
Yes, exit the child and have the supervisor's restart strategy do it's job.
> or any other recommended process architecture for UDP server ?
You could set the restart strategy of the above udp_sup to be
'rest_for_one' which would kill all the other workers when it died.
However that would have the side effect of kill stun_worker and
srtp_worker when dtls_worker exited.
The right way is to have a seperate supervisor for
[dtls|stun|srtp]_worker as a sibling to udp_worker.
--
-Vance
More information about the erlang-questions
mailing list