测试
This commit is contained in:
parent
1b33e66799
commit
8042a498fe
19
device.go
19
device.go
|
@ -76,16 +76,17 @@ func (cli *RPCClient) run() {
|
|||
|
||||
buf.Reset()
|
||||
|
||||
// encode gob
|
||||
enc := gob.NewEncoder(buf)
|
||||
cliBuffer := <-cli.FrameChan
|
||||
enc.Encode(cliBuffer.BytesArray)
|
||||
|
||||
// zstd compress
|
||||
zenc, err := zstd.NewWriter(buf)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
|
||||
enc := gob.NewEncoder(zenc)
|
||||
cliBuffer := <-cli.FrameChan
|
||||
enc.Encode(cliBuffer.BytesArray)
|
||||
|
||||
err = zenc.Flush()
|
||||
err = zenc.Close()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
@ -244,17 +245,15 @@ func (nc *NetCard) runWrite() {
|
|||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
zdec.Close()
|
||||
|
||||
dec := gob.NewDecoder(zdec)
|
||||
|
||||
dec := gob.NewDecoder(buf)
|
||||
var bufs [][]byte
|
||||
err = dec.Decode(&bufs)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
}
|
||||
|
||||
zdec.Close()
|
||||
|
||||
for _, buf := range bufs {
|
||||
_, err := ifce.Write(buf)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user