Skip to content

Commit

Permalink
fix: untyped int constant overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
r3inbowari committed May 8, 2024
1 parent 9a21d98 commit 38e538c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions speedtest/transport/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (

type PacketLossSender struct {
ID string // UUID
nounce int // Random int (maybe) [0,10000000000)
nounce int64 // Random int (maybe) [0,10000000000)
withTimestamp bool // With timestamp (ten seconds level)
conn net.Conn // UDP Conn
raw []byte
Expand All @@ -28,7 +28,7 @@ type PacketLossSender struct {

func NewPacketLossSender(uuid string, dialer *net.Dialer) (*PacketLossSender, error) {
rd := mrand.New(mrand.NewSource(time.Now().UnixNano()))
nounce := rd.Intn(10000000000)
nounce := rd.Int63n(10000000000)
p := &PacketLossSender{
ID: strings.ToUpper(uuid),
nounce: nounce,
Expand Down

0 comments on commit 38e538c

Please sign in to comment.