新增压缩功能-LZS算法

This commit is contained in:
lanrenwo
2023-01-17 12:09:04 +08:00
parent 70c82b8baa
commit 768e137ff9
12 changed files with 212 additions and 23 deletions

View File

@@ -1,8 +1,10 @@
package sessdata
import (
"fmt"
"testing"
"github.com/bjdgyc/anylink/base"
"github.com/stretchr/testify/assert"
)
@@ -34,5 +36,23 @@ func TestConnSession(t *testing.T) {
err = cSess.RateLimit(200, false)
ast.Nil(err)
ast.Equal(cSess.BandwidthDown.Load(), uint32(200))
var (
cmpName string
ok bool
)
base.Cfg.Compression = true
cmpName, ok = cSess.SetPickCmp("cstp", "oc-lz4,lzs")
fmt.Println(cmpName, ok)
ast.True(ok)
ast.Equal(cmpName, "lzs")
cmpName, ok = cSess.SetPickCmp("dtls", "lzs")
ast.True(ok)
ast.Equal(cmpName, "lzs")
cmpName, ok = cSess.SetPickCmp("dtls", "test")
ast.False(ok)
ast.Equal(cmpName, "")
cSess.Close()
}