protobuf解析优化
This commit is contained in:
parent
a3d3c2621f
commit
87668bc9ed
@ -4,11 +4,12 @@ import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"math"
|
||||
"reflect"
|
||||
"server/pkg/github.com/name5566/leaf/chanrpc"
|
||||
"server/pkg/github.com/name5566/leaf/log"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
// -------------------------
|
||||
@ -174,7 +175,11 @@ func (p *Processor) Marshal(msg interface{}) ([][]byte, error) {
|
||||
}
|
||||
|
||||
// data
|
||||
data, err := proto.Marshal(msg.(proto.Message))
|
||||
opts := proto.MarshalOptions{
|
||||
Deterministic: true,
|
||||
}
|
||||
|
||||
data, err := opts.Marshal(msg.(proto.Message))
|
||||
return [][]byte{id, data}, err
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user