]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/tx.go
Do not shadow error during Tx
[nncp.git] / src / tx.go
index b8d47aa6148ae87ad542b20236c67a106130f404..b0377ed9d34b3a7f91c67e451ee2b4683b22c0d6 100644 (file)
--- a/src/tx.go
+++ b/src/tx.go
@@ -1,6 +1,6 @@
 /*
 NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2021 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2022 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
@@ -205,12 +205,13 @@ func (ctx *Ctx) Tx(
                r := <-results
                payloadSize = r.size
                pktEncMsg = r.pktEncRaw
+               wrappers--
        }
        for i := 0; i <= wrappers; i++ {
                r := <-results
                if r.err != nil {
                        tmp.Fd.Close()
-                       return nil, 0, err
+                       return nil, 0, r.err
                }
                if r.pktEncRaw != nil {
                        pktEncRaw = r.pktEncRaw