os.Symlink(nodePath, filepath.Join(ctx.Spool, node.Name))
return err
}
+
+func (ctx *Ctx) TxACK(
+ node *Node,
+ nice uint8,
+ hsh string,
+ minSize int64,
+) error {
+ hshRaw, err := Base32Codec.DecodeString(hsh)
+ if err != nil {
+ return err
+ }
+ if len(hshRaw) != MTHSize {
+ return errors.New("Invalid packet id size")
+ }
+ pkt, err := NewPkt(PktTypeACK, nice, []byte(hshRaw))
+ if err != nil {
+ return err
+ }
+ src := bytes.NewReader([]byte{})
+ _, _, err = ctx.Tx(node, pkt, nice, 0, minSize, MaxFileSize, src, hsh, nil)
+ les := LEs{
+ {"Type", "ack"},
+ {"Node", node.Id},
+ {"Nice", int(nice)},
+ {"Pkt", hsh},
+ }
+ logMsg := func(les LEs) string {
+ return fmt.Sprintf("ACK to %s of %s is sent", ctx.NodeName(node.Id), hsh)
+ }
+ if err == nil {
+ ctx.LogI("tx", les, logMsg)
+ } else {
+ ctx.LogE("tx", les, err, logMsg)
+ }
+ return err
+}