Merge pull request #1658 from dongluochen/raceValidation

Fix a race condition in pending engine validation
This commit is contained in:
Alexandre Beslic 2016-01-20 10:47:34 -08:00
commit 8f31d014e4
1 changed files with 5 additions and 0 deletions

View File

@ -271,6 +271,11 @@ func (c *Cluster) validatePendingEngine(engine *cluster.Engine) bool {
c.Lock()
defer c.Unlock()
// Only validate engines from pendingEngines list
if _, exists := c.pendingEngines[engine.Addr]; !exists {
return false
}
// Make sure the engine ID is unique.
if old, exists := c.engines[engine.ID]; exists {
if old.Addr != engine.Addr {