Skip to content

Commit

Permalink
les, tests: fix vflux fuzzer by removing unnecessary panic (#24537)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored and qinglin89 committed Aug 22, 2022
1 parent 3572eb7 commit c1d9690
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions les/vflux/server/clientpool.go
Expand Up @@ -34,7 +34,7 @@ import (
var (
ErrNotConnected = errors.New("client not connected")
ErrNoPriority = errors.New("priority too low to raise capacity")
ErrCantFindMaximum = errors.New("Unable to find maximum allowed capacity")
ErrCantFindMaximum = errors.New("unable to find maximum allowed capacity")
)

// ClientPool implements a client database that assigns a priority to each client
Expand Down Expand Up @@ -177,7 +177,7 @@ func (cp *ClientPool) Unregister(peer clientPeer) {
cp.ns.SetField(peer.Node(), cp.setup.clientField, nil)
}

// setConnectedBias sets the connection bias, which is applied to already connected clients
// SetConnectedBias sets the connection bias, which is applied to already connected clients
// So that already connected client won't be kicked out very soon and we can ensure all
// connected clients can have enough time to request or sync some data.
func (cp *ClientPool) SetConnectedBias(bias time.Duration) {
Expand Down
4 changes: 1 addition & 3 deletions tests/fuzzers/vflux/clientpool-fuzzer.go
Expand Up @@ -267,9 +267,7 @@ func FuzzClientPool(input []byte) int {
bias = f.randomDelay()
requested = f.randomBool()
)
if _, err := pool.SetCapacity(f.peers[index].node, reqCap, bias, requested); err == vfs.ErrCantFindMaximum {
panic(nil)
}
pool.SetCapacity(f.peers[index].node, reqCap, bias, requested)
doLog("Set capacity", "id", f.peers[index].node.ID(), "reqcap", reqCap, "bias", bias, "requested", requested)
case 7:
index := f.randomByte()
Expand Down

0 comments on commit c1d9690

Please sign in to comment.