<div dir="ltr">For those processes that are per-user, or otherwise spin up and do some work and then go away, we use the simple_one_for_one strategy in the supervisor. In your case, the simple_one_for_one supervisor would start the master process of the session (whether it be a supervisor or something else).<div><br></div><div>If the master process of the user session is a supervisor, you can create whatever state is needed to be shared (an ETS table perhaps, or maybe its own pid) and then pass it to the children when starting. This supervisor would be a one_for_one, one_for_all, or rest_for_one strategy, depending on the dependencies between its children.</div><div><br></div><div>I wonder whether a single process per session will do (or two, one for user connection and one for the proxy connection), with different functionality being kept simply in multiple modules rather than FSMs. For example, if your connection process handling the TCP socket simply shuttles data to and from, you might consider collapsing it into the process that's next up the stack.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 6:14 AM, Imants Cekusins <span dir="ltr"><<a href="mailto:imantc@gmail.com" target="_blank">imantc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">supervisors are meant to supervise only afaik, not to store any state<br>
or do anything else.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Sean Cribbs <<a href="mailto:sean@basho.com" target="_blank">sean@basho.com</a>><br>Sr. Software Engineer<br>Basho Technologies, Inc.<br><a href="http://basho.com/" target="_blank">http://basho.com/</a></div>
</div>