zeromq / zyre

Zyre - an open-source framework for proximity-based peer-to-peer applications
Mozilla Public License 2.0
878 stars 174 forks source link

Problem: Election do not reset when a peer leaves while the election is in progress #696

Closed Mathsoum closed 3 years ago

Mathsoum commented 3 years ago

Solution: Start a new election - or reset the current one if it's still in progress - when a peer leaves

Not resetting the election when a peer leaves during a running election triggered a loop between zyre nodes resulting in endless JOIN/LEAVE messages being sent.
Now, the election AND the group leader (if any) is reset whenever a peer joins or leaves an election channel.
I also renamed some variables while trying to understand the election process and kept those names because I feel it eases the understanding of the code.