<div dir="ltr">Hi Oliver,<div><br></div><div>There is no point supervising a process which is handling a TCP connection as even if the supervisor restarts this process, the socket will not be reinstated. You just have to spawn a new process which will stay alive as long as the connection is active. Once the TCP connection is lost, the process dies, and a new process is spawned when the client reconnects.</div><div><br></div><div>SeeĀ <a href="https://gist.github.com/cmullaparthi/18ba2219befbf7a3c44c28cab004456f">https://gist.github.com/cmullaparthi/18ba2219befbf7a3c44c28cab004456f</a> for a barebones example.</div><div><br></div><div>cheers,</div><div>Chandru</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 13 May 2016 at 14:25, Oliver Korpilla <span dir="ltr"><<a href="mailto:Oliver.Korpilla@gmx.de" target="_blank">Oliver.Korpilla@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello.<br>
<br>
I have transient workers under a simple_one_for_one supervisor. I start them dynamically through start_child/2.<br>
<br>
How exactly do these get restarted? With the same parameter list I supplied when first starting them?<br>
<br>
Concrete example:<br>
<br>
I have a central process listening to a TCP port, then accepting a connection, creating a worker for it through a supervisor, and then using gen_tcp:controlling_process/2 to transfer control of that new socket to the worker. The worker starts with one parameter: the socket.<br>
<br>
Now lets say the worker crashes on unexpected input and gets restarted. Is the socket now closed? Will the same socket again be provided to the process on restart?<br>
<br>
Thanks,<br>
Oliver<br>
_______________________________________________<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" rel="noreferrer" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br></div>