Skip to content

Commit

Permalink
best-route: suppression
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed Dec 17, 2024
1 parent 37f680f commit 0e37c7c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fw/bestroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package fw
import (
"reflect"
"sort"
"time"

"github.com/named-data/YaNFD/core"
"github.com/named-data/YaNFD/defn"
Expand Down Expand Up @@ -61,6 +62,15 @@ func (s *BestRoute) AfterReceiveInterest(
inFace uint64,
nexthops []*table.FibNextHopEntry,
) {
// If there is an out record less than suppression interval
// go, drop the retransmission to suppress it.
for _, outRecord := range pitEntry.OutRecords() {
if outRecord.LatestTimestamp.Add(500 * time.Millisecond).After(time.Now()) {
core.LogDebug(s, "AfterReceiveInterest: Suppressed retransmission of Interest=", packet.Name, " - DROP")
return
}
}

sort.Slice(nexthops, func(i, j int) bool { return nexthops[i].Cost < nexthops[j].Cost })
for _, nh := range nexthops {
core.LogTrace(s, "AfterReceiveInterest: Forwarding Interest=", packet.Name, " to FaceID=", nh.Nexthop)
Expand Down

0 comments on commit 0e37c7c

Please sign in to comment.