/*
NNCP -- Node to Node copy, utilities for store-and-forward data exchange
-Copyright (C) 2016-2022 Sergey Matveev <stargrave@stargrave.org>
+Copyright (C) 2016-2023 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
os.Exit(1)
}
+ acksCreated := os.NewFile(uintptr(4), "ACKsCreated")
+ if acksCreated == nil {
+ log.Fatalln("can not open FD:4")
+ }
+
if *pktRaw != "" {
if len(nodes) != 1 {
usage()
os.Exit(1)
}
nncp.ViaOverride(*viaOverride, ctx, nodes[0])
- if err = ctx.TxACK(nodes[0], nice, *pktRaw, minSize); err != nil {
+ pktName, err := ctx.TxACK(nodes[0], nice, *pktRaw, minSize)
+ if err != nil {
log.Fatalln(err)
}
+ acksCreated.WriteString(nodes[0].Id.String() + "/" + pktName + "\n")
return
}
continue
}
pipeR, pipeW := io.Pipe()
- go nncp.PktEncRead(ctx.Self, ctx.Neigh, bufio.NewReader(fd), pipeW, true, nil)
+ go nncp.PktEncRead(
+ ctx.Self,
+ ctx.Neigh,
+ bufio.NewReaderSize(fd, nncp.MTHBlockSize),
+ pipeW, true, nil,
+ )
var pkt nncp.Pkt
_, err = xdr.Unmarshal(pipeR, &pkt)
fd.Close()
})
continue
}
- if err = ctx.TxACK(node, nice, pktName, minSize); err != nil {
+ newPktName, err := ctx.TxACK(node, nice, pktName, minSize)
+ if err != nil {
log.Fatalln(err)
}
+ acksCreated.WriteString(node.Id.String() + "/" + newPktName + "\n")
}
}
if isBad {