From b9fa5637af53a6b200b6dc2bce4f4ef56345f03e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=80=9D=E6=95=8F?= Date: Fri, 26 Aug 2022 10:54:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- device.go | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/device.go b/device.go index ebcc81b..5081e72 100644 --- a/device.go +++ b/device.go @@ -13,7 +13,6 @@ import ( "sync/atomic" "time" - "github.com/klauspost/compress/zstd" "github.com/songgao/packets/ethernet" "github.com/songgao/water" "github.com/songgao/water/waterutil" @@ -85,14 +84,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) + // } log.Printf("%v %d", cliBuffer, len(buf.Bytes())) // 发到对面的网卡 @@ -236,7 +235,7 @@ func (nc *NetCard) runRead() { func (nc *NetCard) runWrite() { var ifce *water.Interface = nc.ifce - + var err error var buf = bytes.NewBuffer(nil) for wframe := range nc.FrameChan { @@ -244,11 +243,11 @@ func (nc *NetCard) runWrite() { buf.Reset() buf.Write(wframe) - zdec, err := zstd.NewReader(buf) - if err != nil { - log.Panic(err) - } - zdec.Close() + // zdec, err := zstd.NewReader(buf) + // if err != nil { + // log.Panic(err) + // } + // zdec.Close() dec := gob.NewDecoder(buf) var bufs [][]byte