Skip to content

Commit a818f6a

Browse files
committed
fw: don't copy pit token
1 parent 2e581c0 commit a818f6a

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

fw/defn/pkt.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ type Pkt struct {
2020

2121
PitToken []byte
2222
CongestionMark enc.Optional[uint64]
23-
CachePolicy *uint64
2423

2524
IncomingFaceID uint64
2625
NextHopFaceID enc.Optional[uint64]

fw/face/ndnlp-link-service.go

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
defn "github.com/named-data/ndnd/fw/defn"
1717
"github.com/named-data/ndnd/fw/dispatch"
1818
enc "github.com/named-data/ndnd/std/encoding"
19-
"github.com/named-data/ndnd/std/utils"
2019
)
2120

2221
const lpPacketOverhead = 1 + 3 + 1 + 3 // LpPacket+Fragment
@@ -336,16 +335,9 @@ func (l *NDNLPLinkService) handleIncomingFrame(frame []byte) {
336335
pkt.NextHopFaceID = LP.NextHopFaceId
337336
}
338337

339-
// Local cache policy
340-
if l.options.IsLocalCachePolicyEnabled && LP.CachePolicy != nil {
341-
pkt.CachePolicy = utils.IdPtr(LP.CachePolicy.CachePolicyType)
342-
}
343-
344-
// PIT Token
345-
if len(LP.PitToken) > 0 {
346-
pkt.PitToken = make([]byte, len(LP.PitToken))
347-
copy(pkt.PitToken, LP.PitToken)
348-
}
338+
// No need to copy the pit token since it's already in its own buffer
339+
// See the generated code for defn.FwLpPacket
340+
pkt.PitToken = LP.PitToken
349341

350342
// Parse inner packet in place
351343
L3, err := defn.ParseFwPacket(enc.NewWireView(fragment), false)

0 commit comments

Comments
 (0)