]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/toss.go
Merge branch 'develop'
[nncp.git] / src / toss.go
index 67a7311569b41fc7f8f827dba140dddffb127821..0bedecae7a76440b3812519b5fe37c433e4fbcbd 100644 (file)
@@ -1,6 +1,6 @@
 /*
 NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2020 Sergey Matveev <stargrave@stargrave.org>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -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)