]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/toss.go
Lock during tossing
[nncp.git] / src / toss.go
index 05b5a3a6a51cde6862f3f5344bf2d480681f6c1c..0bedecae7a76440b3812519b5fe37c433e4fbcbd 100644 (file)
@@ -68,6 +68,12 @@ func (ctx *Ctx) Toss(
        nice uint8,
        dryRun, doSeen, noFile, noFreq, noExec, noTrns bool,
 ) bool {
+       dirLock, err := ctx.LockDir(nodeId, "toss")
+       if err != nil {
+               ctx.LogE("rx", SDS{}, err, "lock")
+               return false
+       }
+       defer ctx.UnlockDir(dirLock)
        isBad := false
        sendmail := ctx.Neigh[*ctx.SelfId].Exec["sendmail"]
        decompressor, err := zstd.NewReader(nil)