]> Cypherpunks.ru repositories - nncp.git/commitdiff
Autotoss call options
authorSergey Matveev <stargrave@stargrave.org>
Sun, 17 Jan 2021 16:49:01 +0000 (19:49 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 17 Jan 2021 16:52:36 +0000 (19:52 +0300)
doc/call.texi
doc/news.ru.texi
doc/news.texi
src/call.go
src/cfg.go
src/cmd/nncp-caller/main.go
src/cmd/nncp-cfgnew/main.go

index 447b764615af969e24ec8917fbbc50b8f5f00c28..ac24b2a98764ee79838b36561fb46d44791bcf2c 100644 (file)
@@ -11,6 +11,9 @@ calls: [
         cron: "*/1 * * * MON-FRI"
         onlinedeadline: 3600
         nice: PRIORITY+10
+
+        autotoss: true
+        autotoss-doseen: true
     },
     {
         cron: "30 * * * SAT,SUN"
@@ -185,4 +188,9 @@ configuration option when calling.
 Optional. Override @ref{CfgMaxOnlineTime, @emph{maxonlinetime}}
 configuration option when calling.
 
+@item autotoss, -doseen, -nofile, -nofreq, -noexec, -notrns
+Optionally enable auto tossing: run tosser on node's spool every second
+during the call. You can control either are @file{.seen} files must be
+created, or skip any kind of packet processing.
+
 @end table
index 9edf2aa445fcf3da811e1e9cbda9f45c108a68dd..d2c04797646818c73359f5c2e7ad042619aa44d7 100644 (file)
@@ -9,6 +9,13 @@
 @option{-autotoss*} опции запускают tosser не после завершения вызова, а
 во время него ежесекундно.
 
+@item
+В @option{calls} секции конфигурации появились опции
+@option{autotoss}, @option{autotoss-doseen},
+@option{autotoss-nofile}, @option{autotoss-nofreq},
+@option{autotoss-noexec}, @option{autotoss-notrns}.
+Вы можете настраивать опции автоматического tosser для каждого вызова.
+
 @end itemize
 
 @node Релиз 5.5.1
index 624143d5db6710f49c35d42c20e737dfcbaec61f..1b701a96b02f42bea37a4b2b5bdc88ff63fa0907 100644 (file)
@@ -11,6 +11,13 @@ See also this page @ref{Новости, on russian}.
 @option{-autotoss*} option runs tosser not after the call, but every
 second while it is active.
 
+@item
+@option{autotoss}, @option{autotoss-doseen},
+@option{autotoss-nofile}, @option{autotoss-nofreq},
+@option{autotoss-noexec}, @option{autotoss-notrns} options available in
+@option{calls} configuration section. You can configure per-call
+automatic tosser options.
+
 @end itemize
 
 @node Release 5.5.1
index f859167550741e30109990558f9ae4b948a633b5..87fb5aeef9a76769163ee6f78be87790c39e6404 100644 (file)
@@ -33,6 +33,13 @@ type Call struct {
        Addr           *string
        OnlineDeadline time.Duration
        MaxOnlineTime  time.Duration
+
+       AutoToss       bool
+       AutoTossDoSeen bool
+       AutoTossNoFile bool
+       AutoTossNoFreq bool
+       AutoTossNoExec bool
+       AutoTossNoTrns bool
 }
 
 func (ctx *Ctx) CallNode(
index 50ad498d647c1af91dacf9d1e5376f0acc73e7a6..a72d371c141fecd588e8762fa2a758ece1ed18bd 100644 (file)
@@ -81,6 +81,13 @@ type CallJSON struct {
        Addr           *string `json:"addr,omitempty"`
        OnlineDeadline *uint   `json:"onlinedeadline,omitempty"`
        MaxOnlineTime  *uint   `json:"maxonlinetime,omitempty"`
+
+       AutoToss       *bool `json:"autotoss,omitempty"`
+       AutoTossDoSeen *bool `json:"autotoss-doseen,omitempty"`
+       AutoTossNoFile *bool `json:"autotoss-nofile,omitempty"`
+       AutoTossNoFreq *bool `json:"autotoss-nofreq,omitempty"`
+       AutoTossNoExec *bool `json:"autotoss-noexec,omitempty"`
+       AutoTossNoTrns *bool `json:"autotoss-notrns,omitempty"`
 }
 
 type NodeOurJSON struct {
@@ -260,12 +267,7 @@ func NewNode(name string, cfg NodeJSON) (*Node, error) {
                        onlineDeadline = time.Duration(*callCfg.OnlineDeadline) * time.Second
                }
 
-               var maxOnlineTime time.Duration
-               if callCfg.MaxOnlineTime != nil {
-                       maxOnlineTime = time.Duration(*callCfg.MaxOnlineTime) * time.Second
-               }
-
-               calls = append(calls, &Call{
+               call := Call{
                        Cron:           expr,
                        Nice:           nice,
                        Xx:             xx,
@@ -273,8 +275,31 @@ func NewNode(name string, cfg NodeJSON) (*Node, error) {
                        TxRate:         txRate,
                        Addr:           addr,
                        OnlineDeadline: onlineDeadline,
-                       MaxOnlineTime:  maxOnlineTime,
-               })
+               }
+
+               if callCfg.MaxOnlineTime != nil {
+                       call.MaxOnlineTime = time.Duration(*callCfg.MaxOnlineTime) * time.Second
+               }
+               if callCfg.AutoToss != nil {
+                       call.AutoToss = *callCfg.AutoToss
+               }
+               if callCfg.AutoTossDoSeen != nil {
+                       call.AutoTossDoSeen = *callCfg.AutoTossDoSeen
+               }
+               if callCfg.AutoTossNoFile != nil {
+                       call.AutoTossNoFile = *callCfg.AutoTossNoFile
+               }
+               if callCfg.AutoTossNoFreq != nil {
+                       call.AutoTossNoFreq = *callCfg.AutoTossNoFreq
+               }
+               if callCfg.AutoTossNoExec != nil {
+                       call.AutoTossNoExec = *callCfg.AutoTossNoExec
+               }
+               if callCfg.AutoTossNoTrns != nil {
+                       call.AutoTossNoTrns = *callCfg.AutoTossNoTrns
+               }
+
+               calls = append(calls, &call)
        }
 
        node := Node{
index 0a549e45e870c588c4d856a79a5be4771bd897ec..826033c334526166c530c1c8330226dac055080c 100644 (file)
@@ -49,13 +49,6 @@ func main() {
                debug     = flag.Bool("debug", false, "Print debug messages")
                version   = flag.Bool("version", false, "Print version information")
                warranty  = flag.Bool("warranty", false, "Print warranty information")
-
-               autoToss       = flag.Bool("autotoss", false, "Toss after call is finished")
-               autoTossDoSeen = flag.Bool("autotoss-seen", false, "Create .seen files during tossing")
-               autoTossNoFile = flag.Bool("autotoss-nofile", false, "Do not process \"file\" packets during tossing")
-               autoTossNoFreq = flag.Bool("autotoss-nofreq", false, "Do not process \"freq\" packets during tossing")
-               autoTossNoExec = flag.Bool("autotoss-noexec", false, "Do not process \"exec\" packets during tossing")
-               autoTossNoTrns = flag.Bool("autotoss-notrns", false, "Do not process \"trns\" packets during tossing")
        )
        flag.Usage = usage
        flag.Parse()
@@ -143,15 +136,15 @@ func main() {
 
                                                var autoTossFinish chan struct{}
                                                var autoTossBadCode chan bool
-                                               if *autoToss {
+                                               if call.AutoToss {
                                                        autoTossFinish, autoTossBadCode = ctx.AutoToss(
                                                                node.Id,
                                                                call.Nice,
-                                                               *autoTossDoSeen,
-                                                               *autoTossNoFile,
-                                                               *autoTossNoFreq,
-                                                               *autoTossNoExec,
-                                                               *autoTossNoTrns,
+                                                               call.AutoTossDoSeen,
+                                                               call.AutoTossNoFile,
+                                                               call.AutoTossNoFreq,
+                                                               call.AutoTossNoExec,
+                                                               call.AutoTossNoTrns,
                                                        )
                                                }
 
@@ -168,7 +161,7 @@ func main() {
                                                        nil,
                                                )
 
-                                               if *autoToss {
+                                               if call.AutoToss {
                                                        close(autoTossFinish)
                                                        <-autoTossBadCode
                                                }
index a1358add583e3fd0fadb6124047d70e243bc9e04..93f3749df41be8180fc10f9c4261c76dce389666 100644 (file)
@@ -210,6 +210,13 @@ func main() {
     #   #     txrate: 20
     #   #     xx: rx
     #   #     addr: lan
+    #   #
+    #   #     autotoss: false
+    #   #     autotoss-doseen: true
+    #   #     autotoss-nofile: true
+    #   #     autotoss-nofreq: true
+    #   #     autotoss-noexec: true
+    #   #     autotoss-notrns: true
     #   #   },
     #   # ]
     # }