handle reconnect on first connect
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 27s
Build and Publish / BuildAndDeploy (push) Successful in 2m21s

This commit is contained in:
matst80
2024-11-13 11:08:28 +01:00
parent 745fe00d75
commit 3afffe7815

View File

@@ -41,16 +41,17 @@ type PersistentConnection struct {
}
func NewPersistentConnection(address string) (*PersistentConnection, error) {
connection, err := net.Dial("tcp", address)
if err != nil {
return nil, err
}
return &PersistentConnection{
Conn: connection,
p := &PersistentConnection{
Died: make(chan bool, 1),
Dead: false,
address: address,
}, nil
}
err := p.Connect()
if err != nil {
return nil, err
}
return p, nil
}
func (m *PersistentConnection) Connect() error {