]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/call.go
Bad exit code if queues are not empty
[nncp.git] / src / call.go
index de1ce4f6796e12f1490cef36455c69dbc1f03426..95a70d6dcc502e03484c2385d8a665dde3b78bf8 100644 (file)
@@ -27,10 +27,9 @@ import (
 
        "github.com/dustin/go-humanize"
        "github.com/gorhill/cronexpr"
+       nncpYggdrasil "go.cypherpunks.ru/nncp/v8/yggdrasil"
 )
 
-const YggdrasilPrefix = "yggdrasil:"
-
 type Call struct {
        Cron           *cronexpr.Expression
        Nice           uint8
@@ -51,6 +50,7 @@ type Call struct {
        AutoTossNoExec bool
        AutoTossNoTrns bool
        AutoTossNoArea bool
+       AutoTossNoACK  bool
 }
 
 func (ctx *Ctx) CallNode(
@@ -86,11 +86,8 @@ func (ctx *Ctx) CallNode(
                        if addr == "" {
                                addr = UCSPITCPClient
                        }
-               } else if strings.HasPrefix(addr, YggdrasilPrefix) {
-                       conn, err = NewYggdrasilConn(
-                               ctx.YggdrasilAliases,
-                               strings.TrimPrefix(addr, YggdrasilPrefix),
-                       )
+               } else if strings.HasPrefix(addr, "yggdrasilc://") {
+                       conn, err = nncpYggdrasil.NewConn(ctx.YggdrasilAliases, addr)
                } else {
                        conn, err = net.Dial("tcp", addr)
                }
@@ -120,7 +117,7 @@ func (ctx *Ctx) CallNode(
                        ctx.LogI("call-started", les, func(les LEs) string {
                                return fmt.Sprintf("Connection to %s (%s)", node.Name, addr)
                        })
-                       state.Wait()
+                       isGood = state.Wait()
                        ctx.LogI("call-finished", append(
                                les,
                                LE{"Duration", int64(state.Duration.Seconds())},
@@ -141,7 +138,6 @@ func (ctx *Ctx) CallNode(
                                        humanize.IBytes(uint64(state.TxSpeed)),
                                )
                        })
-                       isGood = true
                        conn.Close()
                        break
                } else {