handle reconnect on first connect
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user