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