// SetVotes sets voting parameters for members list
SetVotes sets voting parameters for members list
// SetVotes sets voting parameters for members list
func (m *RSMembers) SetVotes() {
	votes := 0
	lastVoteIdx := -1
	for i, member := range *m {
		if member.Hidden {
			continue
		}
		if votes < MaxVotingMembers {
			[]Member(*m)[i].Votes = 1
			votes++
			if !member.ArbiterOnly {
				lastVoteIdx = i
				[]Member(*m)[i].Priority = 1
			}
		} else if member.ArbiterOnly {
			[]Member(*m)[i].Votes = 1
			[]Member(*m)[lastVoteIdx].Votes = 0
			[]Member(*m)[lastVoteIdx].Priority = 0
		}
	}
	if votes == 0 {
		return
	}
	if votes%2 == 0 {
		[]Member(*m)[lastVoteIdx].Votes = 0
		[]Member(*m)[lastVoteIdx].Priority = 0
	}
}
func ( m * RSMembers ) SetVotes ( ) { votes := 0 lastVoteIdx := - 1 for i , member := range * m { if member . Hidden { continue } if votes < MaxVotingMembers { [ ] Member ( * m ) [ i ] . Votes = 1 votes ++ if ! member . ArbiterOnly { lastVoteIdx = i [ ] Member ( * m ) [ i ] . Priority = 1 } } else if member . ArbiterOnly { [ ] Member ( * m ) [ i ] . Votes = 1 [ ] Member ( * m ) [ lastVoteIdx ] . Votes = 0 [ ] Member ( * m ) [ lastVoteIdx ] . Priority = 0 } } if votes == 0 { return } if votes % 2 == 0 { [ ] Member ( * m ) [ lastVoteIdx ] . Votes = 0 [ ] Member ( * m ) [ lastVoteIdx ] . Priority = 0 } }
SetVotes sets voting parameters for members list
SetVotes sets voting parameters for members list
// Arbiter should always have a vote