框架修复

This commit is contained in:
lifeiyi
2020-03-28 19:53:03 +08:00
parent 9a43744551
commit bffc2b5f79
5 changed files with 21 additions and 7 deletions

View File

@@ -71,13 +71,14 @@ func (slf *PBProcessor ) Unmarshal(data []byte) (interface{}, error) {
// must goroutine safe
func (slf *PBProcessor ) Marshal(msg interface{}) ([]byte, error){
bytes,err := proto.Marshal(msg.(proto.Message))
pMsg := msg.(*PBPackInfo)
bytes,err := proto.Marshal(pMsg.msg.(proto.Message))
if err != nil {
return nil,err
}
buff := make([]byte, 0, len(bytes)+MsgTypeSize)
pMsg := msg.(*PBPackInfo)
buff := make([]byte, 2, len(bytes)+MsgTypeSize)
if slf.LittleEndian == true {
binary.LittleEndian.PutUint16(buff[:2],pMsg.typ)
}else{