bcast.go
func (g *Group) Leave(leaving *Member) error {
	g.memberLock.Lock()
	memberIndex := -1
	for index, member := range g.members {
		if member == leaving {
			memberIndex = index
			break
		}
	}
	if memberIndex == -1 {
		g.memberLock.Unlock()
		return errors.New("Could not find provided member for removal")
	}
	g.members = append(g.members[:memberIndex], g.members[memberIndex+1:]...)
	leaving.close <- true // TODO: need to handle the case where there
	close(leaving.Read)

	// is still stuff in this Members priorityQueue
	g.memberLock.Unlock()
	return nil
}
func (g *Group) Leave(leaving *Member) error {
	g.memberLock.Lock()
	memberIndex := -1
	for index, member := range g.members {
		if member == leaving {
			memberIndex = index
			break
		}
	}
	if memberIndex == -1 {
		g.memberLock.Unlock()
		return errors.New("Could not find provided member for removal")
	}
	g.members = append(g.members[:memberIndex], g.members[memberIndex+1:]...)
	leaving.close <- true // TODO: need to handle the case where there
	close(leaving.Read)

	// is still stuff in this Members priorityQueue
	g.memberLock.Unlock()
	return nil
}
func ( g * Group ) Leave ( leaving * Member ) error { g . memberLock . Lock ( ) memberIndex := - 1 for index , member := range g . members { if member == leaving { memberIndex = index break } } if memberIndex == - 1 { g . memberLock . Unlock ( ) return errors . New ( " " ) } g . members = append ( g . members [ : memberIndex ] , g . members [ memberIndex + 1 : ] ... ) leaving . close <- true // TODO: need to handle the case where there close ( leaving . Read ) // is still stuff in this Members priorityQueue g . memberLock . Unlock ( ) return nil }
// Leave removes the provided member from the group and closes him
Leave removes the provided member from the group and closes him