]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/cmd/nncp-caller/main.go
Autotoss call options
[nncp.git] / src / cmd / nncp-caller / main.go
index 7297350d41b746efa23eb5380726eac15c19e2a9..826033c334526166c530c1c8330226dac055080c 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-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
@@ -133,6 +133,21 @@ func main() {
                                        } else {
                                                node.Busy = true
                                                node.Unlock()
+
+                                               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 +160,12 @@ func main() {
                                                        false,
                                                        nil,
                                                )
+
+                                               if call.AutoToss {
+                                                       close(autoTossFinish)
+                                                       <-autoTossBadCode
+                                               }
+
                                                node.Lock()
                                                node.Busy = false
                                                node.Unlock()