hashicorp / memberlist

Golang package for gossip based membership and failure detection
Mozilla Public License 2.0
3.61k stars 435 forks source link

Checking the state of the Node in NotifyLeave #293

Open krivoguzovVlad opened 10 months ago

krivoguzovVlad commented 10 months ago

I would like to check whether the service was stopped gracefully in NotifyLeave. The callback accepts a Node with a State field, but it is always equal to StateAlive.

Having looked at the code, I believe that the problem is that the State field is simultaneously declared in both Node and nodeState structs, while Node is nested in nodeState. Could someone explain if there are reasons to do this?

I see several solutions, but unfortunately they are not backwards compatible: