X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcall.go;h=95a70d6dcc502e03484c2385d8a665dde3b78bf8;hb=2570c230757df9e463ea072d9110564b53031ce3;hp=f916a8290646a61d340bbe78dedfb7a65e6d20ec;hpb=2758c63b64cf12e5f457daeb78e830959d26faae;p=nncp.git diff --git a/src/call.go b/src/call.go index f916a82..95a70d6 100644 --- a/src/call.go +++ b/src/call.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2021 Sergey Matveev +Copyright (C) 2016-2022 Sergey Matveev 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 @@ -22,10 +22,12 @@ import ( "fmt" "net" "os" + "strings" "time" "github.com/dustin/go-humanize" "github.com/gorhill/cronexpr" + nncpYggdrasil "go.cypherpunks.ru/nncp/v8/yggdrasil" ) type Call struct { @@ -48,6 +50,7 @@ type Call struct { AutoTossNoExec bool AutoTossNoTrns bool AutoTossNoArea bool + AutoTossNoACK bool } func (ctx *Ctx) CallNode( @@ -83,11 +86,13 @@ func (ctx *Ctx) CallNode( if addr == "" { addr = UCSPITCPClient } + } else if strings.HasPrefix(addr, "yggdrasilc://") { + conn, err = nncpYggdrasil.NewConn(ctx.YggdrasilAliases, addr) } else { conn, err = net.Dial("tcp", addr) } if err != nil { - ctx.LogD("calling", append(les, LE{"Err", err}), func(les LEs) string { + ctx.LogE("calling", les, err, func(les LEs) string { return fmt.Sprintf("Calling %s (%s)", node.Name, addr) }) continue @@ -112,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())}, @@ -133,7 +138,6 @@ func (ctx *Ctx) CallNode( humanize.IBytes(uint64(state.TxSpeed)), ) }) - isGood = true conn.Close() break } else {