]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/call.go
Intermediate .nock packets step
[nncp.git] / src / call.go
index f859167550741e30109990558f9ae4b948a633b5..2f635d63d0aa7d36b9fb33a87206cd173db9f4fb 100644 (file)
@@ -33,6 +33,15 @@ type Call struct {
        Addr           *string
        OnlineDeadline time.Duration
        MaxOnlineTime  time.Duration
+       WhenTxExists   bool
+       NoCK           bool
+
+       AutoToss       bool
+       AutoTossDoSeen bool
+       AutoTossNoFile bool
+       AutoTossNoFreq bool
+       AutoTossNoExec bool
+       AutoTossNoTrns bool
 }
 
 func (ctx *Ctx) CallNode(
@@ -43,11 +52,12 @@ func (ctx *Ctx) CallNode(
        rxRate, txRate int,
        onlineDeadline, maxOnlineTime time.Duration,
        listOnly bool,
+       noCK bool,
        onlyPkts map[[32]byte]bool,
 ) (isGood bool) {
        for _, addr := range addrs {
-               sds := SDS{"node": node.Id, "addr": addr}
-               ctx.LogD("call", sds, "dialing")
+               les := LEs{{"Node", node.Id}, {"Addr", addr}}
+               ctx.LogD("call", les, "dialing")
                var conn ConnDeadlined
                var err error
                if addr[0] == '|' {
@@ -56,10 +66,10 @@ func (ctx *Ctx) CallNode(
                        conn, err = net.Dial("tcp", addr)
                }
                if err != nil {
-                       ctx.LogD("call", SdsAdd(sds, SDS{"err": err}), "dialing")
+                       ctx.LogD("call", append(les, LE{"Err", err}), "dialing")
                        continue
                }
-               ctx.LogD("call", sds, "connected")
+               ctx.LogD("call", les, "connected")
                state := SPState{
                        Ctx:            ctx,
                        Node:           node,
@@ -70,24 +80,25 @@ func (ctx *Ctx) CallNode(
                        rxRate:         rxRate,
                        txRate:         txRate,
                        listOnly:       listOnly,
+                       NoCK:           noCK,
                        onlyPkts:       onlyPkts,
                }
                if err = state.StartI(conn); err == nil {
-                       ctx.LogI("call-start", sds, "connected")
+                       ctx.LogI("call-start", les, "connected")
                        state.Wait()
-                       ctx.LogI("call-finish", SDS{
-                               "node":     state.Node.Id,
-                               "duration": int64(state.Duration.Seconds()),
-                               "rxbytes":  state.RxBytes,
-                               "txbytes":  state.TxBytes,
-                               "rxspeed":  state.RxSpeed,
-                               "txspeed":  state.TxSpeed,
+                       ctx.LogI("call-finish", LEs{
+                               {"Node", state.Node.Id},
+                               {"Duration", int64(state.Duration.Seconds())},
+                               {"RxBytes", state.RxBytes},
+                               {"TxBytes", state.TxBytes},
+                               {"RxSpeed", state.RxSpeed},
+                               {"TxSpeed", state.TxSpeed},
                        }, "")
                        isGood = true
                        conn.Close() // #nosec G104
                        break
                } else {
-                       ctx.LogE("call-start", sds, err, "")
+                       ctx.LogE("call-start", les, err, "")
                        conn.Close() // #nosec G104
                }
        }