Add connect status channel
This commit is contained in:
parent
2afb7173ca
commit
ba5db78415
|
@ -22,6 +22,8 @@ type (
|
||||||
|
|
||||||
creationWait sync.WaitGroup
|
creationWait sync.WaitGroup
|
||||||
destroyed bool
|
destroyed bool
|
||||||
|
|
||||||
|
Connected chan bool
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,6 +39,7 @@ func NewSessionManager(connector connector.Connector, authKeyID uint16, password
|
||||||
password: password,
|
password: password,
|
||||||
poolSize: poolSize,
|
poolSize: poolSize,
|
||||||
destroyed: false,
|
destroyed: false,
|
||||||
|
Connected: make(chan bool, 1),
|
||||||
}
|
}
|
||||||
|
|
||||||
manager.household()
|
manager.household()
|
||||||
|
@ -87,6 +90,10 @@ func (s *SessionManager) household() {
|
||||||
s.lock.Lock()
|
s.lock.Lock()
|
||||||
defer s.lock.Unlock()
|
defer s.lock.Unlock()
|
||||||
s.sessions = append(s.sessions, newSession)
|
s.sessions = append(s.sessions, newSession)
|
||||||
|
select {
|
||||||
|
case s.Connected <- true:
|
||||||
|
default:
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in New Issue