ㅑ후
This commit is contained in:
parent
d2e6df0fbf
commit
d899e336c7
|
@ -87,6 +87,18 @@ func (c *Connectors) logHeader() string {
|
|||
return fmt.Sprintf("Connector[%s]: ", c.Name)
|
||||
}
|
||||
|
||||
func (c *Connectors) onDisconnected() {
|
||||
close(c.readChan)
|
||||
close(c.writeChan)
|
||||
|
||||
c.reconnectedChan <- nil
|
||||
|
||||
onDisconnected := c.OnDisconnected
|
||||
if nil != onDisconnected {
|
||||
onDisconnected(c)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Connectors) handleReconnect() {
|
||||
defer func() {
|
||||
c.stopWg.Done()
|
||||
|
@ -101,14 +113,8 @@ RC_LOOP:
|
|||
}
|
||||
|
||||
if 0 >= c.GetReconnectTryTime() {
|
||||
c.reconnectedChan <- nil
|
||||
|
||||
onDisconnected := c.OnDisconnected
|
||||
if nil != onDisconnected {
|
||||
onDisconnected(c)
|
||||
}
|
||||
|
||||
continue RC_LOOP
|
||||
c.onDisconnected()
|
||||
return
|
||||
}
|
||||
|
||||
logging.Logger().Debugf("%s connection lost", c.logHeader())
|
||||
|
@ -126,10 +132,8 @@ RC_LOOP:
|
|||
}
|
||||
|
||||
logging.Logger().Debugf("%s reconnecting has been failed", c.logHeader())
|
||||
onDisconnected := c.OnDisconnected
|
||||
if nil != onDisconnected {
|
||||
onDisconnected(c)
|
||||
}
|
||||
c.onDisconnected()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -124,6 +124,18 @@ func (c *Connectors) logHeader() string {
|
|||
return fmt.Sprintf("Connector[%s]:", c.Name)
|
||||
}
|
||||
|
||||
func (c *Connectors) onDisconnected() {
|
||||
close(c.readChan)
|
||||
close(c.writeChan)
|
||||
|
||||
c.reconnectedChan <- nil
|
||||
|
||||
onDisconnected := c.OnDisconnected
|
||||
if nil != onDisconnected {
|
||||
onDisconnected(c)
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Connectors) handleReconnect() {
|
||||
defer func() {
|
||||
c.stopWg.Done()
|
||||
|
@ -138,14 +150,8 @@ RC_LOOP:
|
|||
}
|
||||
|
||||
if 0 >= c.GetReconnectTryTime() {
|
||||
c.reconnectedChan <- nil
|
||||
|
||||
onDisconnected := c.OnDisconnected
|
||||
if nil != onDisconnected {
|
||||
onDisconnected(c)
|
||||
}
|
||||
|
||||
continue RC_LOOP
|
||||
c.onDisconnected()
|
||||
return
|
||||
}
|
||||
|
||||
logging.Logger().Debugf("%s connection lost", c.logHeader())
|
||||
|
@ -168,10 +174,8 @@ RC_LOOP:
|
|||
}
|
||||
logging.Logger().Debugf("%s reconnecting has been failed", c.logHeader())
|
||||
|
||||
onDisconnected := c.OnDisconnected
|
||||
if nil != onDisconnected {
|
||||
onDisconnected(c)
|
||||
}
|
||||
c.onDisconnected()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user