/*
NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2019 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2021 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
} 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,
false,
nil,
)
+
+ if call.AutoToss {
+ close(autoTossFinish)
+ <-autoTossBadCode
+ }
+
node.Lock()
node.Busy = false
node.Unlock()