Add connect status channel

This commit is contained in:
Hendrik Hofstadt 2018-09-08 21:22:18 +02:00
parent 2afb7173ca
commit ba5db78415
1 changed files with 7 additions and 0 deletions

View File

@ -22,6 +22,8 @@ type (
creationWait sync.WaitGroup
destroyed bool
Connected chan bool
}
)
@ -37,6 +39,7 @@ func NewSessionManager(connector connector.Connector, authKeyID uint16, password
password: password,
poolSize: poolSize,
destroyed: false,
Connected: make(chan bool, 1),
}
manager.household()
@ -87,6 +90,10 @@ func (s *SessionManager) household() {
s.lock.Lock()
defer s.lock.Unlock()
s.sessions = append(s.sessions, newSession)
select {
case s.Connected <- true:
default:
}
}()
}
}()