浏览代码

Merge pull request #2500 from xiang90/fix-panic

etcdmain: verify heartbeat and election flag
Xiang Li 10 年之前
父节点
当前提交
862c16e821
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      etcdmain/config.go

+ 4 - 0
etcdmain/config.go

@@ -255,6 +255,10 @@ func (cfg *config) Parse(arguments []string) error {
 		return errors.New("cannot resolve DNS hostnames.")
 		return errors.New("cannot resolve DNS hostnames.")
 	}
 	}
 
 
+	if 5*cfg.TickMs > cfg.ElectionMs {
+		return fmt.Errorf("-election-timeout[%vms] should be at least as 5 times as -heartbeat-interval[%vms]", cfg.ElectionMs, cfg.TickMs)
+	}
+
 	return nil
 	return nil
 }
 }