Wait for account manager shutdown during server shutdown.

This commit is contained in:
Josh Rickmar 2014-06-24 16:11:06 -05:00
parent b145868a4b
commit 5155ea1b28
2 changed files with 4 additions and 1 deletions

View file

@ -108,9 +108,10 @@ func (am *AccountManager) Start() {
// Ready the semaphore - can't grab unless the manager has started. // Ready the semaphore - can't grab unless the manager has started.
am.bsem <- struct{}{} am.bsem <- struct{}{}
am.wg.Add(4) am.wg.Add(2)
go am.accountHandler() go am.accountHandler()
go am.rescanListener() go am.rescanListener()
go am.ds.Start() go am.ds.Start()
go am.rm.Start() go am.rm.Start()
} }
@ -537,6 +538,7 @@ func (am *AccountManager) rescanListener() {
} }
AcctMgr.Release() AcctMgr.Release()
} }
am.wg.Done()
} }
// Grab grabs the account manager's binary semaphore. A custom semaphore // Grab grabs the account manager's binary semaphore. A custom semaphore

View file

@ -400,6 +400,7 @@ func (s *rpcServer) Stop() {
} }
func (s *rpcServer) WaitForShutdown() { func (s *rpcServer) WaitForShutdown() {
AcctMgr.WaitForShutdown()
s.wg.Wait() s.wg.Wait()
} }