package canal

import (
	"proxy/logger"
	"time"
)

var CurState string= "init"
func CanalFsm(addr string, username string, password string) {
	t := time.NewTimer(time.Second * 2)
	defer t.Stop()
	for {
		<-t.C// wait for next tick

		//if config.Config.CanalServer.Standalone || (!config.Config.CanalServer.Standalone && rds.CheckIfRdbMaster() == true) {
			StartMyCanal(addr, username, password)
			logger.CanalLog.Warnf("Exit Canal!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
			t.Reset(time.Second * 3)
		/*} else {
			CurState = "idle"
			if config.Config.CanalServer.Reinit {
				config.Config.CanalServer.Reinit = false
				config.SavePcfCfg()
			}
			t.Reset(time.Second * 2)
		}*/
	}
}
