]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/call.go
On demand calling
[nncp.git] / src / call.go
index 034ba286884496da6f2a7384ef6c18e0652ded22..1635b3042c77036b697421b601e821dc8dcaf176 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
@@ -19,6 +19,7 @@ package nncp
 
 import (
        "net"
+       "time"
 
        "github.com/gorhill/cronexpr"
 )
@@ -30,8 +31,16 @@ type Call struct {
        RxRate         int
        TxRate         int
        Addr           *string
-       OnlineDeadline uint
-       MaxOnlineTime  uint
+       OnlineDeadline time.Duration
+       MaxOnlineTime  time.Duration
+       WhenTxExists   bool
+
+       AutoToss       bool
+       AutoTossDoSeen bool
+       AutoTossNoFile bool
+       AutoTossNoFreq bool
+       AutoTossNoExec bool
+       AutoTossNoTrns bool
 }
 
 func (ctx *Ctx) CallNode(
@@ -40,7 +49,7 @@ func (ctx *Ctx) CallNode(
        nice uint8,
        xxOnly TRxTx,
        rxRate, txRate int,
-       onlineDeadline, maxOnlineTime uint,
+       onlineDeadline, maxOnlineTime time.Duration,
        listOnly bool,
        onlyPkts map[[32]byte]bool,
 ) (isGood bool) {
@@ -83,11 +92,11 @@ func (ctx *Ctx) CallNode(
                                "txspeed":  state.TxSpeed,
                        }, "")
                        isGood = true
-                       conn.Close()
+                       conn.Close() // #nosec G104
                        break
                } else {
                        ctx.LogE("call-start", sds, err, "")
-                       conn.Close()
+                       conn.Close() // #nosec G104
                }
        }
        return