Skip to content

Commit

Permalink
fix stale comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt committed Oct 4, 2024
1 parent 17569ef commit 9a2212b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions p2p/protocol/circuitv2/relay/constraints.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ func newConstraints(rc *Resources) *constraints {
}
}

// AddReservation adds a reservation for a given peer with a given multiaddr.
// If adding this reservation violates IP constraints, an error is returned.
// Reserve adds a reservation for a given peer with a given multiaddr.
// If adding this reservation violates IP, ASN, or total reservation constraints, an error is returned.
func (c *constraints) Reserve(p peer.ID, a ma.Multiaddr, expiry time.Time) error {
c.mutex.Lock()
defer c.mutex.Unlock()
Expand Down
4 changes: 2 additions & 2 deletions p2p/protocol/circuitv2/relay/constraints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ func TestConstraints(t *testing.T) {
t.Fatal(err)
}
if err := c.Reserve(p2, ipAddr, expiry); err != errTooManyReservationsForIP {
t.Fatalf("expected to run into total reservation limit, got %v", err)
t.Fatalf("expected to run into IP reservation limit as this IP has already been reserved by a different peer, got %v", err)
}
if err := c.Reserve(p, randomIPv4Addr(t), expiry); err != nil {
t.Fatalf("expected to update reservation for peer, got %v", err)
t.Fatalf("expected to update existing reservation for peer, got %v", err)
}
if err := c.Reserve(p2, ipAddr, expiry); err != nil {
t.Fatalf("expected reservation for different peer to be possible, got %v", err)
Expand Down
2 changes: 1 addition & 1 deletion p2p/protocol/circuitv2/relay/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func DefaultResources() Resources {
MaxCircuits: 16,
BufferSize: 2048,

MaxReservationsPerPeer: 4,
MaxReservationsPerPeer: 1,
MaxReservationsPerIP: 8,
MaxReservationsPerASN: 32,
}
Expand Down

0 comments on commit 9a2212b

Please sign in to comment.