_stoping_ supervision branch

Hello everyone,

I’m looking for an advice regarding mentioned problem - what would be the semantic approach for stopping supervision branch?

In my problem, I have a master process (that maintains ssh connection) which is supervised. Obviously, this supervision branch is only one amongst other possible connections. How should one branch, for one connection be stoped (eg. closing the ssh connection).

Should my master process hold reference to it’s Supervisor, and then, just call Supervisor.stop/1 only? Initially I was returning :stop tuple to only stop the GenServer - should my Supervisor detect that its master process finished the work exiting with :normal reason and then stop itself?

I’m talking about master supervisor, because this functionality could potentially be expanded by adding some less important processes to supervision branch - eg. dedicated logger, which should also be stoped, when the master process finishes it’s work. Would that safe thinking this is still the same category of problem, and thus, same solution would apply?

Any advice or expansion in my thinking will be appreciated!