mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-27 13:36:57 +00:00
Merge tag 'v1.14.3'
This commit is contained in:
@@ -146,10 +146,16 @@ func (c *CacheFile) SetDisableExpire(disableExpire bool) {
|
||||
c.disableExpire = disableExpire
|
||||
}
|
||||
|
||||
func (c *CacheFile) Start(stage adapter.StartStage) error {
|
||||
func (c *CacheFile) Start(stage adapter.StartStage, scope *adapter.Scope) error {
|
||||
switch stage {
|
||||
case adapter.StartStateInitialize:
|
||||
return c.start()
|
||||
err := c.start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
scope.Add(func() error {
|
||||
return c.database().Close()
|
||||
})
|
||||
case adapter.StartStateStart:
|
||||
c.startCacheCleanup()
|
||||
}
|
||||
@@ -245,16 +251,6 @@ func (c *CacheFile) start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *CacheFile) Close() error {
|
||||
c.dbAccess.RLock()
|
||||
db := c.DB
|
||||
c.dbAccess.RUnlock()
|
||||
if db == nil {
|
||||
return nil
|
||||
}
|
||||
return db.Close()
|
||||
}
|
||||
|
||||
func checkDatabase(db *bbolt.DB) error {
|
||||
return db.View(func(tx *bbolt.Tx) error {
|
||||
var checkErr error
|
||||
|
||||
Reference in New Issue
Block a user