Skip to content

Commit

Permalink
feat: remove the dead rngPool
Browse files Browse the repository at this point in the history
Signed-off-by: Rueian <[email protected]>
  • Loading branch information
rueian committed Jun 19, 2024
1 parent 077fc01 commit b5d3439
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rueidis

import (
"context"
"math/rand"
"net"
"runtime"
"sync"
Expand Down Expand Up @@ -394,22 +393,11 @@ func isBroken(err error, w wire) bool {
return err != nil && err != ErrClosing && w.Error() != nil
}

var rngPool = sync.Pool{
New: func() any {
return rand.New(rand.NewSource(time.Now().UnixNano()))
},
}

func fastrand(n int) (r int) {
r = util.FastRand(n)
return
}

func slotfn(n int, ks uint16, noreply bool) uint16 {
if n == 1 || ks == cmds.NoSlot || noreply {
return 0
}
return uint16(fastrand(n))
return uint16(util.FastRand(n))
}

type muxslots struct {
Expand Down

0 comments on commit b5d3439

Please sign in to comment.