From ba5db784153db7ae24d5d929777cd2ebf08b8a0a Mon Sep 17 00:00:00 2001 From: Hendrik Hofstadt Date: Sat, 8 Sep 2018 21:22:18 +0200 Subject: [PATCH] Add connect status channel --- manager.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manager.go b/manager.go index 596f40d..f29a1bf 100644 --- a/manager.go +++ b/manager.go @@ -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: + } }() } }()