1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-03-08 23:45:29 -04:00

Fix when rolled number is zero

This commit is contained in:
Shelikhoo
2020-06-02 17:30:48 +08:00
parent 13cef19430
commit 5e59534333
2 changed files with 3 additions and 1 deletions

View File

@@ -38,6 +38,8 @@ const (
RequestOptionChunkMasking bitmask.Byte = 0x04
RequestOptionGlobalPadding bitmask.Byte = 0x08
RequestOptionEarlyChecksum bitmask.Byte = 0x16
)
type RequestHeader struct {

View File

@@ -126,7 +126,7 @@ func parseSecurityType(b byte) protocol.SecurityType {
func (s *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.RequestHeader, error) {
buffer := buf.New()
behaviorRand := dice.NewDeterministicDice(int64(s.userValidator.GetBehaviorSeed()))
DrainSize := behaviorRand.Roll(3266) + 16 + 38 + dice.Roll(behaviorRand.Roll(64))
DrainSize := behaviorRand.Roll(3266) + 16 + 38 + dice.Roll(behaviorRand.Roll(64)+1)
readSizeRemain := DrainSize
drainConnection := func(e error) error {