import (
"errors"
+ "os"
+ "path/filepath"
)
type Ctx struct {
}
return node, nil
}
+
+func (ctx *Ctx) ensureRxDir(nodeId *NodeId) error {
+ dirPath := filepath.Join(ctx.Spool, nodeId.String(), string(TRx))
+ if err := os.MkdirAll(dirPath, os.FileMode(0700)); err != nil {
+ ctx.LogE("llp-ensure", SDS{"dir": dirPath, "err": err}, "")
+ return err
+ }
+ fd, err := os.Open(dirPath)
+ if err != nil {
+ ctx.LogE("llp-ensure", SDS{"dir": dirPath, "err": err}, "")
+ return err
+ }
+ fd.Close()
+ return nil
+}
return payloadsSplit(payloads)
}
-func (ctx *Ctx) ensureRxDir(nodeId *NodeId) error {
- dirPath := filepath.Join(ctx.Spool, nodeId.String(), string(TRx))
- if err := os.MkdirAll(dirPath, os.FileMode(0700)); err != nil {
- ctx.LogE("llp-ensure", SDS{"dir": dirPath, "err": err}, "")
- return err
- }
- fd, err := os.Open(dirPath)
- if err != nil {
- ctx.LogE("llp-ensure", SDS{"dir": dirPath, "err": err}, "")
- return err
- }
- fd.Close()
- return nil
-}
-
func (ctx *Ctx) StartI(conn net.Conn, nodeId *NodeId, nice uint8, xxOnly *TRxTx) (*LLPState, error) {
err := ctx.ensureRxDir(nodeId)
if err != nil {
if len(infosPayloads) > 0 {
firstPayload = infosPayloads[0]
}
+ // Pad first payload, to hide actual existing files
for i := 0; i < (MaxLLPSize-len(firstPayload))/LLPHeadOverhead; i++ {
firstPayload = append(firstPayload, LLPHaltMarshalized...)
}
if len(infosPayloads) > 0 {
firstPayload = infosPayloads[0]
}
+ // Pad first payload, to hide actual existing files
for i := 0; i < (MaxLLPSize-len(firstPayload))/LLPHeadOverhead; i++ {
firstPayload = append(firstPayload, LLPHaltMarshalized...)
}