etcd: Verify struct is not nil before accessing retries value
This didn't happen often because there's a nominateCallback race, but is a bug which happened occasionally.
This commit is contained in:
@@ -1409,8 +1409,12 @@ func (obj *EmbdEtcd) nominateCallback(re *RE) error {
|
||||
obj.nominated, // other peer members and urls or empty map
|
||||
)
|
||||
if err != nil {
|
||||
retries := 0
|
||||
if re != nil {
|
||||
retries = re.retries
|
||||
}
|
||||
// retry maxStartServerRetries times, then permanently fail
|
||||
return &CtxRetriesErr{maxStartServerRetries - re.retries, fmt.Sprintf("Etcd: StartServer: Error: %+v", err)}
|
||||
return &CtxRetriesErr{maxStartServerRetries - retries, fmt.Sprintf("Etcd: StartServer: Error: %+v", err)}
|
||||
}
|
||||
|
||||
if len(obj.endpoints) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user