checksummed. Can be checksummed (with @file{.nock} extension removing)
with @command{nncp-check -nock}.
- Also it can contain @file{.seen} files, that should be cleaned too
- from time to time.
+ Also it can contain @file{seen/} and @file{hdr/} subdirectories,
+ that should be cleaned too from time to time.
All of that cleaning tasks can be done with @ref{nncp-rm} utility.
@item autotoss, -doseen, -nofile, -nofreq, -noexec, -notrns
Optionally enable auto tossing: run tosser on node's spool every second
-during the call. You can control either are @file{.seen} files must be
+during the call. You can control either are @file{seen/} files must be
created, or skip any kind of packet processing.
@item when-tx-exists
option anyway.
@anchor{CfgNoHdr}
@item nohdr
-@strong{nohdr} option disables @ref{HdrFile, .hdr} files usage.
+@strong{nohdr} option disables @ref{HdrFile, @file{hdr/}} files usage.
@end table
And optional @ref{MCD, MultiCast Discovery} options:
@ref{nncp-check, @command{nncp-check -nock}}, that will checksum files
and strip the @file{.nock} extension, then repeated call to remote node
will notify about packet's completion. Also it will be notified if
-@ref{nncp-toss, tossing} created @file{.seen} file.
+@ref{nncp-toss, tossing} created @file{seen/} file.
Read @ref{CfgNoCK, more} about @option{-nock} option.
@item @option{-part} option deletes @file{.part}ly downloaded files.
-@item @option{-seen} option deletes @file{.seen} files. But it does not
-apply to @ref{Multicast, multicast areas} @file{.seen} ones!
+@item @option{-seen} option deletes @file{seen/} files. But it does not
+apply to @ref{Multicast, multicast areas} ones!
@item @option{-nock} option deletes non-checksummed (non-verified)
@file{.nock} files.
-@item @option{-hdr} option deletes cached @file{.hdr} files.
+@item @option{-hdr} option deletes cached @file{hdr/} files.
-@item @option{-area} option deletes @file{.seen} files in @file{area/}
-subdirectories.
+@item @option{-area} option deletes seen files in @file{area/} subdirectories.
@end itemize
@option{INT} seconds in an infinite loop. That can be useful when
running this command as a daemon.
-@option{-seen} option creates empty @file{XXX.seen} file after
+@option{-seen} option creates empty @file{seen/XXX} file after
successful tossing of @file{XXX} packet. @ref{nncp-xfer},
@ref{nncp-bundle}, @ref{nncp-daemon} and @ref{nncp-call} commands skip
inbound packets that has been already seen, processed and tossed. This
--- /dev/null
+redo-ifchange \
+ ../config \
+ ../VERSION \
+ *.texi \
+ cfg/*.texi \
+ cmd/*.texi \
+ integration/*.texi \
+ pedro.txt \
+ pkt/*.texi \
+ sp.plantuml.txt \
+ usecases.ru/*.texi \
+ usecases/*.texi
+. ../config
+${MAKEINFO:-makeinfo} \
+ -D "VERSION `cat ../VERSION`" \
+ $MAKEINFO_OPTS \
+ --set-customization-variable SECTION_NAME_IN_TITLE=1 \
+ --set-customization-variable TREE_TRANSFORMATIONS=complete_tree_nodes_menus \
+ --set-customization-variable CLOSE_QUOTE_SYMBOL=\" \
+ --set-customization-variable OPEN_QUOTE_SYMBOL=\" \
+ --output $3 index.texi
@itemize
@item check if that message was already seen (sent or received from)
before by the destination node: check existence of
- @file{SPOOL/NODE/area/AREA/MsgHash.seen} file. Skip that node if
+ @file{SPOOL/NODE/area/AREA/MsgHash} file. Skip that node if
it exists
@item if subscriber's node is not the one we received the packet
from, then create outgoing encrypted packet to it, with that
area packet inside
- @item create corresponding @file{MsgHash.seen} file
+ @item create corresponding @file{MsgHash} file
@item "rewind" the outer encrypted file to the beginning and repeat
the whole cycle again, while all of subscribers will "seen" that
area's message.
consumption.
@end itemize
@item check if we have seen that area's message before by looking at
- @file{SPOOL/SELF/area/AREA/MsgHash.seen}. If so, remove the packet,
+ @file{SPOOL/SELF/area/AREA/MsgHash}. If so, remove the packet,
because it is just a ordinary possible duplicate, finish its processing
@item check if we have got corresponding area's private key. If no key
exists, then remove the packet, finish its processing -- we just
@command{nncp-file} creates an encrypted packet with area packet and
encrypted packet inside it, with our own @code{self} node as a recipient
(in the @file{SPOOL/SELF/tx} directory). It also creates the
-@file{SPOOL/SELF/area/AREA/MSGHASH.seen} file.
+@file{SPOOL/SELF/area/AREA/MsgHash} file.
@item
@command{nncp-toss} sees @file{tx/} file and "opens" it, applying the
area message tossing procedure as described above. That will create
outgoing packets in @file{SPOOL/nodeB/tx} and @file{SPOOL/nodeD/tx}
-directories with @file{SPOOL/nodeB/area/AREA/MSGHASH.seen}
-@file{SPOOL/nodeD/area/AREA/MSGHASH.seen} files. Because we already have
-@file{SPOOL/SELF/area/AREA/MSGHASH.seen}, that packet is removed then.
+directories with @file{SPOOL/nodeB/area/AREA/MsgHash}
+@file{SPOOL/nodeD/area/AREA/MsgHash} files. Because we already have
+@file{SPOOL/SELF/area/AREA/MsgHash}, that packet is removed then.
@item
When @code{nodeB} receives the encrypted packet, it sees the area one
@item
@code{nodeD} receives packets from both @code{nodeA} and @code{nodeB}.
Only one of them processed, and other is ignored because corresponding
-@file{MSGHASH.seen} file will exist.
+@file{MsgHash} file will exist.
If @code{nodeD} will receive packet from the @code{nodeB} first, it will
relay it to the @code{nodeA} also, that will silently remove it when
изменениях в spool директориях, для сокращения накладных расходов на их
частое чтение.
+@item
+@file{.seen} и @file{.hdr} файлы находятся в @file{seen/} и @file{hdr/}
+поддиректориях теперь, дабы ускорить сканирование spool областей.
+Необходима миграция текущих файлов:
+
+@example
+$ find $NNCPSPOOL -type f -name "*.hdr" -exec rm @{@} +
+
+$ find $NNCPSPOOL -type d -name rx | while read rx ; do
+ cd $rx
+ mkdir -p seen
+ find . -type f -name "*.seen" | while read fn ; do
+ mv $fn seen/$@{fn%.seen@}
+ done
+done
+
+$ find $NNCPSPOOL -type d -name area | while read area ; do
+ find $area -type f -name "*.seen" | while read fn ; do
+ mv $fn $@{fn%.seen@}
+ done
+done
+@end example
+
@end itemize
@node Релиз 7.6.0
support about spool directory changes, for reducing their often reading
overhead.
+@item
+@file{.seen} and @file{.hdr} files moved to @file{seen/} and @file{hdr/}
+subdirectories, for faster scanning of spool directories.
+Current files migration required:
+
+@example
+$ find $NNCPSPOOL -type f -name "*.hdr" -exec rm @{@} +
+
+$ find $NNCPSPOOL -type d -name rx | while read rx ; do
+ cd $rx
+ mkdir -p seen
+ find . -type f -name "*.seen" | while read fn ; do
+ mv $fn seen/$@{fn%.seen@}
+ done
+done
+
+$ find $NNCPSPOOL -type d -name area | while read area ; do
+ find $area -type f -name "*.seen" | while read fn ; do
+ mv $fn $@{fn%.seen@}
+ done
+done
+@end example
+
@end itemize
@node Release 7_6_0
+redo-ifchange makeinfo.rc
rm -fr nncp.html
MAKEINFO_OPTS="$MAKEINFO_OPTS --html --css-include style.css"
MAKEINFO_OPTS="$MAKEINFO_OPTS --set-customization-variable FORMAT_MENU=menu"
MAKEINFO_OPTS="$MAKEINFO_OPTS --set-customization-variable SHOW_TITLE=0"
MAKEINFO_OPTS="$MAKEINFO_OPTS --set-customization-variable DATE_IN_HEADER=1"
-MAKEINFO_OPTS="$MAKEINFO_OPTS" . nncp.info.do
+MAKEINFO_OPTS="$MAKEINFO_OPTS" . makeinfo.rc
-redo-ifchange \
- ../config \
- ../VERSION \
- *.texi \
- cfg/*.texi \
- cmd/*.texi \
- integration/*.texi \
- pedro.txt \
- pkt/*.texi \
- sp.plantuml.txt \
- usecases.ru/*.texi \
- usecases/*.texi
-. ../config
-${MAKEINFO:-makeinfo} \
- -D "VERSION `cat ../VERSION`" \
- $MAKEINFO_OPTS \
- --set-customization-variable SECTION_NAME_IN_TITLE=1 \
- --set-customization-variable TREE_TRANSFORMATIONS=complete_tree_nodes_menus \
- --set-customization-variable CLOSE_QUOTE_SYMBOL=\" \
- --set-customization-variable OPEN_QUOTE_SYMBOL=\" \
- --output $3 index.texi
+redo-ifchange makeinfo.rc
+MAKEINFO_OPTS="--no-split" . makeinfo.rc
Ignore it if it is too nice.
@item If already downloaded file exists, then queue @emph{DONE}
sending.
- @item If @file{.seen} exists, then queue @emph{DONE} sending.
+ @item If @file{seen/XXX} exists, then queue @emph{DONE} sending.
@item If @file{.part} exists, then queue @emph{FREQ} sending with
corresponding offset.
@end itemize
verified against its filename either by @ref{nncp-check}, or by working
online daemons. If it is correct, then its extension is trimmed.
-@item LYT64MWSNDK34CVYOO7TA6ZCJ3NWI2OUDBBMX2A4QWF34FIRY4DQ.seen
+@item seen/LYT64MWSNDK34CVYOO7TA6ZCJ3NWI2OUDBBMX2A4QWF34FIRY4DQ
@ref{nncp-toss} utility can be invoked with @option{-seen} option,
-leading to creation of @file{.seen} files, telling that the file with
+leading to creation of @file{seen/} files, telling that the file with
specified hash has already been processed before. It could be useful
when there are use-cases where multiple ways of packets transfer
available and there is possibility of duplicates reception. You have to
are expired).
@anchor{HdrFile}
-@item LYT64MWSNDK34CVYOO7TA6ZCJ3NWI2OUDBBMX2A4QWF34FIRY4DQ.hdr
+@item hdr/LYT64MWSNDK34CVYOO7TA6ZCJ3NWI2OUDBBMX2A4QWF34FIRY4DQ
If no @ref{CfgNoHdr, nohdr} option is enabled in configuration file,
-then @file{.hdr} files are automatically created for every ordinary
+then @file{hdr/} files are automatically created for every ordinary
(fully received and checksummed) packet. It literally contains just the
header of the corresponding packet. It will be automatically created
even during simple @ref{nncp-stat} call. On filesystems with big
other filesystems probably it won't help at all, or even harm
performance.
-There is a hack: you can create more dense @file{.hdr} allocation by
-removing all @file{.hdr} files and then running @command{nncp-stat},
-that will recreate them. In many cases many @file{.hdr} files will be
+There is a hack: you can create more dense @file{hdr/} allocation by
+removing all @file{hdr/} files and then running @command{nncp-stat},
+that will recreate them. In many cases many @file{hdr/} files will be
allocated more or less linearly on the disk, decreasing listing time
even more.
if err = os.Remove(job.Path); err != nil {
log.Fatalln("Error during deletion:", err)
} else if ctx.HdrUsage {
- os.Remove(job.Path + nncp.HdrSuffix)
+ os.Remove(nncp.JobPath2Hdr(job.Path))
}
}
ctx.LogI(
if !*dryRun {
os.Remove(dstPath)
if ctx.HdrUsage {
- os.Remove(dstPath + nncp.HdrSuffix)
+ os.Remove(nncp.JobPath2Hdr(dstPath))
}
}
} else {
})
continue
}
- if _, err = os.Stat(dstPath + nncp.SeenSuffix); err == nil || !os.IsNotExist(err) {
+ if _, err = os.Stat(filepath.Join(
+ dstDirPath, nncp.SeenDir, pktName,
+ )); err == nil || !os.IsNotExist(err) {
ctx.LogD("bundle-rx-seen", les, func(les nncp.LEs) string {
return logMsg(les) + ": packet already seen"
})
maxOnlineTimeSec = flag.Uint("maxonlinetime", 0, "Override maxonlinetime option")
autoToss = flag.Bool("autotoss", false, "Toss after call is finished")
- autoTossDoSeen = flag.Bool("autotoss-seen", false, "Create .seen files during tossing")
+ autoTossDoSeen = flag.Bool("autotoss-seen", false, "Create seen/ files during tossing")
autoTossNoFile = flag.Bool("autotoss-nofile", false, "Do not process \"file\" packets during tossing")
autoTossNoFreq = flag.Bool("autotoss-nofreq", false, "Do not process \"freq\" packets during tossing")
autoTossNoExec = flag.Bool("autotoss-noexec", false, "Do not process \"exec\" packets during tossing")
warranty = flag.Bool("warranty", false, "Print warranty information")
autoToss = flag.Bool("autotoss", false, "Toss after call is finished")
- autoTossDoSeen = flag.Bool("autotoss-seen", false, "Create .seen files during tossing")
+ autoTossDoSeen = flag.Bool("autotoss-seen", false, "Create seen/ files during tossing")
autoTossNoFile = flag.Bool("autotoss-nofile", false, "Do not process \"file\" packets during tossing")
autoTossNoFreq = flag.Bool("autotoss-nofreq", false, "Do not process \"freq\" packets during tossing")
autoTossNoExec = flag.Bool("autotoss-noexec", false, "Do not process \"exec\" packets during tossing")
# umask: "022"
# Omit progress showing by default
# noprogress: true
- # Do not use .hdr files
+ # Do not use hdr/ files
# nohdr: true
# MultiCast Discovery:
warranty = flag.Bool("warranty", false, "Print warranty information")
autoToss = flag.Bool("autotoss", false, "Toss after call is finished")
- autoTossDoSeen = flag.Bool("autotoss-seen", false, "Create .seen files during tossing")
+ autoTossDoSeen = flag.Bool("autotoss-seen", false, "Create seen/ files during tossing")
autoTossNoFile = flag.Bool("autotoss-nofile", false, "Do not process \"file\" packets during tossing")
autoTossNoFreq = flag.Bool("autotoss-nofreq", false, "Do not process \"freq\" packets during tossing")
autoTossNoExec = flag.Bool("autotoss-noexec", false, "Do not process \"exec\" packets during tossing")
cfgPath = flag.String("cfg", nncp.DefaultCfgPath, "Path to configuration file")
doAll = flag.Bool("all", false, "Apply remove rules to all nodes")
doTmp = flag.Bool("tmp", false, "Remove all temporary files")
- doHdr = flag.Bool("hdr", false, "Remove all .hdr files")
+ doHdr = flag.Bool("hdr", false, "Remove all hdr/ files")
doLock = flag.Bool("lock", false, "Remove all lock files")
nodeRaw = flag.String("node", "", "Node to remove files in")
doRx = flag.Bool("rx", false, "Process received packets")
doTx = flag.Bool("tx", false, "Process transfered packets")
doPart = flag.Bool("part", false, "Remove only .part files")
- doSeen = flag.Bool("seen", false, "Remove only .seen files")
+ doSeen = flag.Bool("seen", false, "Remove only seen/ files")
doNoCK = flag.Bool("nock", false, "Remove only .nock files")
- doArea = flag.Bool("area", false, "Remove only area/*.seen files")
+ doArea = flag.Bool("area", false, "Remove only area/* seen files")
older = flag.String("older", "", "XXX{smhd}: only older than XXX number of time units")
dryRun = flag.Bool("dryrun", false, "Do not actually remove files")
pktRaw = flag.String("pkt", "", "Packet to remove")
})
return nil
}
- if (*doSeen && strings.HasSuffix(info.Name(), nncp.SeenSuffix)) ||
- (*doNoCK && strings.HasSuffix(info.Name(), nncp.NoCKSuffix)) ||
- (*doHdr && strings.HasSuffix(info.Name(), nncp.HdrSuffix)) ||
+ if (*doNoCK && strings.HasSuffix(info.Name(), nncp.NoCKSuffix)) ||
(*doPart && strings.HasSuffix(info.Name(), nncp.PartSuffix)) {
ctx.LogI("rm", nncp.LEs{{K: "File", V: path}}, logMsg)
if *dryRun {
return nil
})
}
- if *pktRaw != "" || *doRx || *doSeen || *doNoCK || *doHdr || *doPart {
+ if *pktRaw != "" || *doRx || *doNoCK || *doPart {
if err = remove(nncp.TRx); err != nil {
log.Fatalln("Can not remove:", err)
}
log.Fatalln("Can not remove:", err)
}
}
+ removeSub := func(p string, everything bool) error {
+ return filepath.Walk(
+ p, func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ if os.IsNotExist(err) {
+ return nil
+ }
+ return err
+ }
+ if info.IsDir() {
+ return nil
+ }
+ logMsg := func(les nncp.LEs) string {
+ return fmt.Sprintf("File %s: removed", path)
+ }
+ if everything {
+ ctx.LogI("rm", nncp.LEs{{K: "File", V: path}}, logMsg)
+ if *dryRun {
+ return nil
+ }
+ return os.Remove(path)
+ }
+ if now.Sub(info.ModTime()) < oldBoundary {
+ ctx.LogD(
+ "rm-skip", nncp.LEs{{K: "File", V: path}},
+ func(les nncp.LEs) string {
+ return fmt.Sprintf("File %s: too fresh, skipping", path)
+ },
+ )
+ } else if !*dryRun {
+ return os.Remove(path)
+ }
+ return nil
+ },
+ )
+ }
+ if *doRx || *doSeen {
+ if err = removeSub(filepath.Join(
+ ctx.Spool, node.Id.String(), string(nncp.TRx), nncp.SeenDir,
+ ), *doSeen); err != nil {
+ log.Fatalln("Can not remove:", err)
+ }
+ }
+ if *doRx || *doHdr {
+ if err = removeSub(filepath.Join(
+ ctx.Spool, node.Id.String(), string(nncp.TRx), nncp.HdrDir,
+ ), *doHdr); err != nil {
+ log.Fatalln("Can not remove:", err)
+ }
+ }
+ if *doTx || *doHdr {
+ if err = removeSub(filepath.Join(
+ ctx.Spool, node.Id.String(), string(nncp.TTx), nncp.HdrDir,
+ ), *doHdr); err != nil {
+ log.Fatalln("Can not remove:", err)
+ }
+ }
if *doArea {
if err = filepath.Walk(
filepath.Join(ctx.Spool, node.Id.String(), nncp.AreaDir),
})
return nil
}
- if strings.HasSuffix(info.Name(), nncp.SeenSuffix) {
- ctx.LogI(
- "rm",
- nncp.LEs{{K: "File", V: path}},
- func(les nncp.LEs) string {
- return fmt.Sprintf("File %s: removed", path)
- },
- )
- if *dryRun {
- return nil
- }
- return os.Remove(path)
+ ctx.LogI(
+ "rm",
+ nncp.LEs{{K: "File", V: path}},
+ func(les nncp.LEs) string {
+ return fmt.Sprintf("File %s: removed", path)
+ },
+ )
+ if *dryRun {
+ return nil
}
- return nil
+ return os.Remove(path)
}); err != nil {
log.Fatalln("Can not remove:", err)
}
nodeRaw = flag.String("node", "", "Process only that node")
niceRaw = flag.String("nice", nncp.NicenessFmt(255), "Minimal required niceness")
dryRun = flag.Bool("dryrun", false, "Do not actually write any tossed data")
- doSeen = flag.Bool("seen", false, "Create .seen files")
+ doSeen = flag.Bool("seen", false, "Create seen/ files")
cycle = flag.Uint("cycle", 0, "Repeat tossing after N seconds in infinite loop")
noFile = flag.Bool("nofile", false, "Do not process \"file\" packets")
noFreq = flag.Bool("nofreq", false, "Do not process \"freq\" packets")
})
continue
}
- if _, err = os.Stat(filepath.Join(dstPath, pktName+nncp.SeenSuffix)); err == nil || !os.IsNotExist(err) {
+ if _, err = os.Stat(filepath.Join(
+ dstPath, nncp.SeenDir, pktName,
+ )); err == nil || !os.IsNotExist(err) {
ctx.LogD("xfer-tx-seen", les, func(les nncp.LEs) string {
return logMsg(les) + ": already seen"
})
})
isBad = true
} else if ctx.HdrUsage {
- os.Remove(job.Path + nncp.HdrSuffix)
+ os.Remove(nncp.JobPath2Hdr(job.Path))
}
}
}
return node, nil
}
-func ensureDir(p string) error {
+func ensureDir(dirs ...string) error {
+ p := filepath.Join(dirs...)
fi, err := os.Stat(p)
if err == nil {
if fi.IsDir() {
TRx TRxTx = "rx"
TTx TRxTx = "tx"
- HdrSuffix = ".hdr"
+ HdrDir = "hdr"
)
type Job struct {
HshValue *[MTHSize]byte
}
+func JobPath2Hdr(jobPath string) string {
+ return filepath.Join(filepath.Dir(jobPath), HdrDir, filepath.Base(jobPath))
+}
+
func (ctx *Ctx) HdrRead(r io.Reader) (*PktEnc, []byte, error) {
var pktEnc PktEnc
_, err := xdr.Unmarshal(r, &pktEnc)
os.Remove(tmpHdr.Name())
return err
}
- if err = os.Rename(tmpHdr.Name(), tgt+HdrSuffix); err != nil {
+ if err = ensureDir(filepath.Dir(tgt), HdrDir); err != nil {
+ ctx.LogE("hdr-write-ensure-mkdir", nil, err, func(les LEs) string {
+ return "Header writing: ensuring directory"
+ })
+ return err
+ }
+ if err = os.Rename(tmpHdr.Name(), JobPath2Hdr(tgt)); err != nil {
ctx.LogE("hdr-write-rename", nil, err, func(les LEs) string {
return "Header writing: renaming"
})
if nock || part {
fd, err = os.Open(pth)
} else {
- fd, err = os.Open(pth + HdrSuffix)
+ fd, err = os.Open(JobPath2Hdr(pth))
if err != nil && os.IsNotExist(err) {
hdrExists = false
fd, err = os.Open(pth)
}
continue
}
- if _, err = os.Stat(pktPath + SeenSuffix); err == nil {
+ if _, err = os.Stat(filepath.Join(
+ state.Ctx.Spool, state.Node.Id.String(), string(TRx),
+ SeenDir, Base32Codec.EncodeToString(info.Hash[:]),
+ )); err == nil {
state.Ctx.LogI("sp-info-seen", lesp, func(les LEs) string {
return logMsg(les) + ": already seen"
})
return fmt.Sprintf("Packet %s is sent", pktName)
})
if state.Ctx.HdrUsage {
- os.Remove(pth + HdrSuffix)
+ os.Remove(JobPath2Hdr(pth))
}
} else {
state.Ctx.LogE("sp-done", lesp, err, logMsg)
)
const (
- SeenSuffix = ".seen"
+ SeenDir = "seen"
)
+func jobPath2Seen(jobPath string) string {
+ return filepath.Join(filepath.Dir(jobPath), SeenDir, filepath.Base(jobPath))
+}
+
func newNotification(fromTo *FromToJSON, subject string, body []byte) io.Reader {
lines := []string{
"From: " + fromTo.From,
})
if !dryRun && jobPath != "" {
if doSeen {
- if fd, err := os.Create(jobPath + SeenSuffix); err == nil {
+ if err := ensureDir(filepath.Dir(jobPath), SeenDir); err != nil {
+ return err
+ }
+ if fd, err := os.Create(jobPath2Seen(jobPath)); err == nil {
fd.Close()
if err = DirSync(filepath.Dir(jobPath)); err != nil {
ctx.LogE("rx-dirsync", les, err, func(les LEs) string {
})
return err
} else if ctx.HdrUsage {
- os.Remove(jobPath + HdrSuffix)
+ os.Remove(JobPath2Hdr(jobPath))
}
}
if !dryRun {
if jobPath != "" {
if doSeen {
- if fd, err := os.Create(jobPath + SeenSuffix); err == nil {
+ if err := ensureDir(filepath.Dir(jobPath), SeenDir); err != nil {
+ return err
+ }
+ if fd, err := os.Create(jobPath2Seen(jobPath)); err == nil {
fd.Close()
if err = DirSync(filepath.Dir(jobPath)); err != nil {
ctx.LogE("rx-dirsync", les, err, func(les LEs) string {
})
return err
} else if ctx.HdrUsage {
- os.Remove(jobPath + HdrSuffix)
+ os.Remove(JobPath2Hdr(jobPath))
}
}
if len(sendmail) > 0 && ctx.NotifyFile != nil {
if !dryRun {
if jobPath != "" {
if doSeen {
- if fd, err := os.Create(jobPath + SeenSuffix); err == nil {
+ if err := ensureDir(filepath.Dir(jobPath), SeenDir); err != nil {
+ return err
+ }
+ if fd, err := os.Create(jobPath2Seen(jobPath)); err == nil {
fd.Close()
if err = DirSync(filepath.Dir(jobPath)); err != nil {
ctx.LogE("rx-dirsync", les, err, func(les LEs) string {
})
return err
} else if ctx.HdrUsage {
- os.Remove(jobPath + HdrSuffix)
+ os.Remove(JobPath2Hdr(jobPath))
}
}
if len(sendmail) > 0 && ctx.NotifyFreq != nil {
})
if !dryRun && jobPath != "" {
if doSeen {
- if fd, err := os.Create(jobPath + SeenSuffix); err == nil {
+ if err := ensureDir(filepath.Dir(jobPath), SeenDir); err != nil {
+ return err
+ }
+ if fd, err := os.Create(jobPath2Seen(jobPath)); err == nil {
fd.Close()
if err = DirSync(filepath.Dir(jobPath)); err != nil {
ctx.LogE("rx-dirsync", les, err, func(les LEs) string {
})
return err
} else if ctx.HdrUsage {
- os.Remove(jobPath + HdrSuffix)
+ os.Remove(JobPath2Hdr(jobPath))
}
}
seenDir := filepath.Join(
ctx.Spool, nodeId.String(), AreaDir, area.Id.String(),
)
- seenPath := filepath.Join(seenDir, msgHash+SeenSuffix)
+ seenPath := filepath.Join(seenDir, msgHash)
logMsgNode := func(les LEs) string {
return fmt.Sprintf(
"%s: echoing to: %s", logMsg(les), node.Name,
seenDir := filepath.Join(
ctx.Spool, nodeId.String(), AreaDir, area.Id.String(),
)
- seenPath := filepath.Join(seenDir, msgHash+SeenSuffix)
+ seenPath := filepath.Join(seenDir, msgHash)
logMsgNode := func(les LEs) string {
return fmt.Sprintf("%s: echo to: %s", logMsg(les), node.Name)
}
seenDir := filepath.Join(
ctx.Spool, ctx.SelfId.String(), AreaDir, area.Id.String(),
)
- seenPath := filepath.Join(seenDir, msgHash+SeenSuffix)
+ seenPath := filepath.Join(seenDir, msgHash)
if _, err := os.Stat(seenPath); err == nil {
ctx.LogD("rx-area-seen", les, func(les LEs) string {
return logMsg(les) + ": already seen"
})
return err
} else if ctx.HdrUsage {
- os.Remove(jobPath + HdrSuffix)
+ os.Remove(JobPath2Hdr(jobPath))
}
}
return nil
})
return err
} else if ctx.HdrUsage {
- os.Remove(jobPath + HdrSuffix)
+ os.Remove(JobPath2Hdr(jobPath))
}
}
seenDir := filepath.Join(
ctx.Spool, ctx.SelfId.String(), AreaDir, areaId.String(),
)
- seenPath := filepath.Join(seenDir, msgHash+SeenSuffix)
+ seenPath := filepath.Join(seenDir, msgHash)
les := LEs{
{"Node", node.Id},
{"Nice", int(nice)},