Open
Description
Currently the shutdown flag is needed because the p2p parts (tasks) are tightly coupled together and there is no easy way to organize a clear shutdown process. The tasks communicate using channels and when one of the tasks is shut down, it closes its end of a channel and that is considered an error by other tasks. The ChannelClosed
error is used for that. When the shutdown flag is set such errors are basically ignored, otherwise an error is reported.
Ideally a graceful termination shouldn't require this flag and a shutdown order should be established. For example, backend can signal to the peer and the sync managers to shut down and wait for the corresponding tasks to be finished.