测试
This commit is contained in:
parent
288bc1e699
commit
3125dbb804
31
netcard.go
31
netcard.go
|
@ -16,6 +16,7 @@ import (
|
|||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/klauspost/compress/zstd"
|
||||
"github.com/songgao/packets/ethernet"
|
||||
"github.com/songgao/water"
|
||||
"github.com/songgao/water/waterutil"
|
||||
|
@ -97,14 +98,14 @@ func (cli *RPCClient) run() {
|
|||
}
|
||||
|
||||
// zstd compress
|
||||
// zenc, err := zstd.NewWriter(buf)
|
||||
// if err != nil {
|
||||
// log.Panic(err)
|
||||
// }
|
||||
// err = zenc.Flush()
|
||||
// if err != nil {
|
||||
// log.Println(err)
|
||||
// }
|
||||
zenc, err := zstd.NewWriter(buf)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
err = zenc.Flush()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
||||
// 发到对面的网卡
|
||||
err = stream.Send(&gen.Request{
|
||||
|
@ -259,14 +260,14 @@ func (nc *NetCard) runWrite() {
|
|||
log.Printf("get wframes bytes len: %d", len(wframe))
|
||||
var buf = bytes.NewBuffer(wframe)
|
||||
|
||||
// zdec, err := zstd.NewReader(buf)
|
||||
// if err != nil {
|
||||
// log.Panic(err)
|
||||
// }
|
||||
var zdec *zstd.Decoder
|
||||
zdec, err = zstd.NewReader(buf)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
zdec.Close()
|
||||
|
||||
// zdec.Close()
|
||||
|
||||
dec := gob.NewDecoder(buf)
|
||||
dec := gob.NewDecoder(zdec)
|
||||
var bufs [][]byte
|
||||
err = dec.Decode(&bufs)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user