X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcmd%2Fnncp-caller%2Fmain.go;h=f7ab13c23299cc301608920776df84f417266042;hb=561313b1994a8fadac5152bbdc7a980881fd93e0;hp=7297350d41b746efa23eb5380726eac15c19e2a9;hpb=1d2ce674b042d07fd9b37a46578c8b62bb0345b7;p=nncp.git diff --git a/src/cmd/nncp-caller/main.go b/src/cmd/nncp-caller/main.go index 7297350..f7ab13c 100644 --- a/src/cmd/nncp-caller/main.go +++ b/src/cmd/nncp-caller/main.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2019 Sergey Matveev +Copyright (C) 2016-2021 Sergey Matveev 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 @@ -133,6 +133,40 @@ func main() { } else { node.Busy = true node.Unlock() + + if call.WhenTxExists && call.Xx != "TRx" { + ctx.LogD("caller", sds, "checking tx existence") + txExists := false + for job := range ctx.Jobs(node.Id, nncp.TTx) { + job.Fd.Close() + if job.PktEnc.Nice > call.Nice { + continue + } + txExists = true + } + if !txExists { + ctx.LogD("caller", sds, "no tx") + node.Lock() + node.Busy = false + node.Unlock() + continue + } + } + + var autoTossFinish chan struct{} + var autoTossBadCode chan bool + if call.AutoToss { + autoTossFinish, autoTossBadCode = ctx.AutoToss( + node.Id, + call.Nice, + call.AutoTossDoSeen, + call.AutoTossNoFile, + call.AutoTossNoFreq, + call.AutoTossNoExec, + call.AutoTossNoTrns, + ) + } + ctx.CallNode( node, addrs, @@ -145,6 +179,12 @@ func main() { false, nil, ) + + if call.AutoToss { + close(autoTossFinish) + <-autoTossBadCode + } + node.Lock() node.Busy = false node.Unlock()