Skip to content

Commit

Permalink
Merge pull request #55 from templexxx/master
Browse files Browse the repository at this point in the history
替换 ec 库
  • Loading branch information
xtaci committed Sep 4, 2017
2 parents edee1a2 + a433761 commit 44c3d76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,6 +1,6 @@
language: go
go:
- 1.8
- 1.9

before_install:
- go get -t -v ./...
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -169,4 +169,4 @@ A: A standalone `agent` or `gate` server for kcp-go is suggested, not only for C

1. https://github.com/xtaci/libkcp -- FEC enhanced KCP session library for iOS/Android in C++
2. https://github.com/skywind3000/kcp -- A Fast and Reliable ARQ Protocol
3. https://github.com/klauspost/reedsolomon -- Reed-Solomon Erasure Coding in Go
3. https://github.com/templexxx/reedsolomon -- Reed-Solomon Erasure Coding in Go
8 changes: 4 additions & 4 deletions fec.go
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/binary"
"sync/atomic"

"github.com/klauspost/reedsolomon"
"github.com/templexxx/reedsolomon"
)

const (
Expand Down Expand Up @@ -52,7 +52,7 @@ func newFECDecoder(rxlimit, dataShards, parityShards int) *fecDecoder {
fec.dataShards = dataShards
fec.parityShards = parityShards
fec.shardSize = dataShards + parityShards
enc, err := reedsolomon.New(dataShards, parityShards, reedsolomon.WithMaxGoroutines(1))
enc, err := reedsolomon.New(dataShards, parityShards)
if err != nil {
return nil
}
Expand Down Expand Up @@ -157,7 +157,7 @@ func (dec *fecDecoder) decode(pkt fecPacket) (recovered [][]byte) {
xorBytes(shards[k][dlen:], shards[k][dlen:], shards[k][dlen:])
}
}
if err := dec.codec.Reconstruct(shards); err == nil {
if err := dec.codec.ReconstructData(shards); err == nil {
for k := range shards[:dec.dataShards] {
if !shardsflag[k] {
recovered = append(recovered, shards[k])
Expand Down Expand Up @@ -226,7 +226,7 @@ func newFECEncoder(dataShards, parityShards, offset int) *fecEncoder {
fec.headerOffset = offset
fec.payloadOffset = fec.headerOffset + fecHeaderSize

enc, err := reedsolomon.New(dataShards, parityShards, reedsolomon.WithMaxGoroutines(1))
enc, err := reedsolomon.New(dataShards, parityShards)
if err != nil {
return nil
}
Expand Down

0 comments on commit 44c3d76

Please sign in to comment.