Merge "Fix LevelDB closing order."

This commit is contained in:
Julius Volz 2014-02-03 23:22:30 +01:00 committed by Gerrit Code Review
commit 8cadae6102

View File

@ -260,12 +260,6 @@ func NewLevelDBPersistence(o LevelDBOptions) (*LevelDBPersistence, error) {
func (l *LevelDBPersistence) Close() error {
// These are deferred to take advantage of forced closing in case of stack
// unwinding due to anomalies.
defer func() {
if l.storage != nil {
l.storage.Close()
}
}()
defer func() {
if l.filterPolicy != nil {
l.filterPolicy.Close()
@ -296,6 +290,12 @@ func (l *LevelDBPersistence) Close() error {
}
}()
defer func() {
if l.storage != nil {
l.storage.Close()
}
}()
return nil
}