Skip to content

Commit

Permalink
Stop uses of database before closing db.
Browse files Browse the repository at this point in the history
Since the stop RPC and ^C interrupt handling now shutdown the process
using the same code path, the closeDB callback needs to stop any
remaining uses of the database before closing the DB.

This should prevent any database corruption issues that may happen
during clean shutdown, but unclean shutdown can still corrupt the
database since not all operations that should be atomic actually are.
  • Loading branch information
jrick committed Mar 3, 2016
1 parent 8ac528e commit 9c9699f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dcrwallet.go
Expand Up @@ -132,7 +132,10 @@ func walletMain() error {
}()
loader.RunAfterLoad(func(w *wallet.Wallet, db walletdb.DB) {
startWalletRPCServices(w, rpcs, legacyRPCServer)
closeDB = db.Close
closeDB = func() error {
w.CloseDatabases()
return db.Close()
}
})

if !cfg.NoInitialLoad {
Expand Down

0 comments on commit 9c9699f

Please sign in to comment.