Remove the shutdown flag in the p2p
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.
@discosultan , sorry I didn't notice you were the assignee for that issue. I didn't mean to hijack the issue.
@RGafiyatullin No worries at all, I only assigned myself yesterday :) will review your PR shortly. Thanks for the contribution!
Related: #943