Skip to content

Commit

Permalink
add extra check in auto tune
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Oct 9, 2020
1 parent 582575e commit dd1ac88
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions fec.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,21 @@ func (dec *fecDecoder) decode(in fecPacket) (recovered [][]byte) {

// edges found, we can tune parameters now
if autoDS > 0 && autoPS > 0 && autoDS < 256 && autoPS < 256 {
dec.dataShards = autoDS
dec.parityShards = autoPS
dec.shardSize = autoDS + autoPS
dec.rxlimit = rxFECMulti * dec.shardSize
codec, err := reedsolomon.New(autoDS, autoPS)
if err != nil {
return nil
// and make sure it's different
if autoDS != dec.dataShards || autoPS != dec.parityShards {
dec.dataShards = autoDS
dec.parityShards = autoPS
dec.shardSize = autoDS + autoPS
dec.rxlimit = rxFECMulti * dec.shardSize
codec, err := reedsolomon.New(autoDS, autoPS)
if err != nil {
return nil
}
dec.codec = codec
dec.decodeCache = make([][]byte, dec.shardSize)
dec.flagCache = make([]bool, dec.shardSize)
//log.Println("autotune to :", dec.dataShards, dec.parityShards)
}
dec.codec = codec
dec.decodeCache = make([][]byte, dec.shardSize)
dec.flagCache = make([]bool, dec.shardSize)
//log.Println("autotune to :", dec.dataShards, dec.parityShards)
}
}

Expand Down

0 comments on commit dd1ac88

Please sign in to comment.