mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
Previously there was a bug which happened v rarely in which: > Outbound and Manual Session are waiting on a stop signal > Outbound/ Manual receives a stop signal, de-registers channel (in move_host) > Channel is selected by Slot 1 to be connected to, state is changed to Connect > remove_sub_on_stop() receives a stop signal, de-registers channel > Channel is selected by Slot 5 connected to, state is changed to Connect > Slot 1 connects, state is changed to Connected > Slot 5 connects -> panic! To avoid this happening, we move unregister() out of move_host and perform the sequence: recv stop signal -> move_host to greylist (if outbond/manual) -> unregister() We do this inside the shared method remove_sub_on_stop to ensure the execution path always happens in the same way.