Skip to content

Commit

Permalink
fix: EventProbeRemove should also remove from routing table (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
iand authored Sep 11, 2023
1 parent b09141f commit 18d9578
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions routing/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ func (p *Probe[K, A]) Advance(ctx context.Context, ev ProbeEvent) ProbeState {
p.nvl.Put(nv)
case *EventProbeRemove[K]:
span.SetAttributes(attribute.String("event", "EventProbeRemove"), attribute.String("nodeid", tev.NodeID.String()))
p.rt.RemoveKey(tev.NodeID.Key())
p.nvl.Remove(tev.NodeID)
return &StateProbeNodeFailure[K]{
NodeID: tev.NodeID,
}
case *EventProbeMessageResponse[K, A]:
span.SetAttributes(attribute.String("event", "EventProbeMessageResponse"), attribute.String("nodeid", tev.NodeInfo.ID().String()))
nv, found := p.nvl.Get(tev.NodeInfo.ID())
Expand Down
4 changes: 2 additions & 2 deletions routing/probe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ func TestProbeRemoveDeletesNodeValue(t *testing.T) {
NodeID: kadtest.NewID(key.Key8(4)),
})

// state should remain idle
require.IsType(t, &StateProbeIdle{}, state)
// state indicate that node failed
require.IsType(t, &StateProbeNodeFailure[key.Key8]{}, state)

// advance time by one revisit interval
clk.Add(cfg.CheckInterval)
Expand Down

0 comments on commit 18d9578

Please sign in to comment.