mintlayer-core icon indicating copy to clipboard operation
mintlayer-core copied to clipboard

Remove the shutdown flag in the p2p

Open stanislav-tkach opened this issue 2 years ago • 3 comments

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.

stanislav-tkach avatar May 11 '23 20:05 stanislav-tkach

@discosultan , sorry I didn't notice you were the assignee for that issue. I didn't mean to hijack the issue.

RGafiyatullin avatar Jun 08 '23 10:06 RGafiyatullin

@RGafiyatullin No worries at all, I only assigned myself yesterday :) will review your PR shortly. Thanks for the contribution!

discosultan avatar Jun 08 '23 10:06 discosultan

Related: #943

TheQuantumPhysicist avatar Jul 13 '23 21:07 TheQuantumPhysicist