slaskit
This commit is contained in:
@@ -57,6 +57,7 @@ func (m *PersistentConnection) Connect() error {
|
||||
if !m.Dead {
|
||||
connection, err := net.Dial("tcp", m.address)
|
||||
if err != nil {
|
||||
log.Printf("Error connecting to %s: %v\n", m.address, err)
|
||||
m.Died <- true
|
||||
m.Dead = true
|
||||
return err
|
||||
@@ -74,6 +75,7 @@ func (m *PersistentConnection) Close() {
|
||||
|
||||
func (m *PersistentConnection) HandleConnectionError(err error) error {
|
||||
if err != nil {
|
||||
log.Printf("Error from to %s: %v\n", m.address, err)
|
||||
m.Conn.Close()
|
||||
m.Connect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user