FlowForwarding/LINC-Switch — pull request #207 by legoscia (2013-11-04 13:56:31+00:00)
Title: Attempt to avoid the dreaded no function clause matching linc_us4:stop([])

I tried to dig into the reasons for this error, and it turns out that it is in fact masking other errors, namely linc_logic attempts to add children to the linc_sup supervisor but gets `already_started` errors. This happens because those child processes were added to linc_sup by a previous incarnation of linc_logic using `permanent` or `transient` restart types, meaning that the supervisor would hold on to the child spec and restart these processes, denying linc_logic the opportunity to do so.

This patch fixes the problem by changing the restart types to `temporary`, such that linc_sup can restart just once and end up with an orderly tree of child processes. This may not be the best solution - would we want to use a less aggressive restart strategy, to keep as many processes as possible running? In particular, I'm thinking about the port and channel supervisors. Opinions gratefully accepted.