From 5155ea1b286f7e3a4d7a020ec3c11b72b77cc4f4 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 24 Jun 2014 16:11:06 -0500 Subject: [PATCH] Wait for account manager shutdown during server shutdown. --- acctmgr.go | 4 +++- rpcserver.go | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/acctmgr.go b/acctmgr.go index 39d3250..f37124f 100644 --- a/acctmgr.go +++ b/acctmgr.go @@ -108,9 +108,10 @@ func (am *AccountManager) Start() { // Ready the semaphore - can't grab unless the manager has started. am.bsem <- struct{}{} - am.wg.Add(4) + am.wg.Add(2) go am.accountHandler() go am.rescanListener() + go am.ds.Start() go am.rm.Start() } @@ -537,6 +538,7 @@ func (am *AccountManager) rescanListener() { } AcctMgr.Release() } + am.wg.Done() } // Grab grabs the account manager's binary semaphore. A custom semaphore diff --git a/rpcserver.go b/rpcserver.go index c140a72..94f3688 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -400,6 +400,7 @@ func (s *rpcServer) Stop() { } func (s *rpcServer) WaitForShutdown() { + AcctMgr.WaitForShutdown() s.wg.Wait() }