+ if *doACK {
+ dirPath := filepath.Join(
+ ctx.Spool, node.Id.String(), string(nncp.TTx), nncp.ACKDir)
+ dir, err := os.Open(dirPath)
+ if err != nil {
+ continue
+ }
+ for {
+ fis, err := dir.ReadDir(1 << 10)
+ if err != nil {
+ if err == io.EOF {
+ break
+ }
+ log.Fatalln("Can not read directory:", err)
+ }
+ for _, fi := range fis {
+ for _, pth := range []string{
+ filepath.Join(
+ ctx.Spool,
+ node.Id.String(),
+ string(nncp.TTx),
+ fi.Name(),
+ ),
+ filepath.Join(dirPath, fi.Name()),
+ } {
+ if err = os.Remove(pth); err == nil {
+ ctx.LogI(
+ "rm",
+ nncp.LEs{{K: "File", V: pth}},
+ func(les nncp.LEs) string {
+ return fmt.Sprintf("File %s: removed", pth)
+ },
+ )
+ } else if !errors.Is(err, fs.ErrNotExist) {
+ log.Fatalln("Can not remove:", pth, ":", err)
+ }
+ }
+ }
+ }
+ dir.Close()
+ }