mirror of
https://github.com/mjl-/mox.git
synced 2024-12-27 08:53:48 +03:00
doRemove flag
This commit is contained in:
parent
36470f9d95
commit
0db5612cae
1 changed files with 3 additions and 3 deletions
|
@ -110,7 +110,7 @@ func (i *ImapTemp) CreateSocket(dir ...string) (imapConn net.Conn, err error) {
|
||||||
if i.dir, err = os.MkdirTemp(useDefaultTempDir, dirTemplate); err != nil {
|
if i.dir, err = os.MkdirTemp(useDefaultTempDir, dirTemplate); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
i.noRemove.Store(true)
|
i.doRemove.Store(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// make mox able to run
|
// make mox able to run
|
||||||
|
@ -276,7 +276,7 @@ func (i *ImapTemp) unCreate() (err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// remove temporary files, ignore error if an error is already present
|
// remove temporary files, ignore error if an error is already present
|
||||||
if !i.noRemove.Load() {
|
if i.doRemove.Load() {
|
||||||
if e := os.RemoveAll(i.dir); e != nil && err == nil {
|
if e := os.RemoveAll(i.dir); e != nil && err == nil {
|
||||||
err = e
|
err = e
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ type ImapTemp struct {
|
||||||
// true if timeouts should not be disabled
|
// true if timeouts should not be disabled
|
||||||
useTimeouts atomic.Bool
|
useTimeouts atomic.Bool
|
||||||
// true if file system is not temporary and should not be removed
|
// true if file system is not temporary and should not be removed
|
||||||
noRemove atomic.Bool
|
doRemove atomic.Bool
|
||||||
|
|
||||||
// absolute path to temporary file-system storage
|
// absolute path to temporary file-system storage
|
||||||
// - thread-safe through isCreateServer read and write
|
// - thread-safe through isCreateServer read and write
|
||||||
|
|
Loading…
Reference in a new issue