fix can not close slave if master is down

This commit is contained in:
siddontang 2015-02-14 09:25:21 +08:00
parent 3cd534aefb
commit fde91d588a
1 changed files with 4 additions and 0 deletions

View File

@ -155,6 +155,10 @@ func (m *master) runReplication(restart bool) {
for { for {
m.state.Set(replConnectState) m.state.Set(replConnectState)
if m.needQuit() {
return
}
if _, err := m.conn.Do("ping"); err != nil { if _, err := m.conn.Do("ping"); err != nil {
log.Errorf("ping master %s error %s, try 3s later", m.addr, err.Error()) log.Errorf("ping master %s error %s, try 3s later", m.addr, err.Error())
time.Sleep(3 * time.Second) time.Sleep(3 * time.Second)