@@ -24,7 +24,7 @@ import (
24
24
25
25
import (
26
26
"github.com/dubbogo/getty"
27
- hessian "github.com/dubbogo/hessian2"
27
+ "github.com/dubbogo/hessian2"
28
28
perrors "github.com/pkg/errors"
29
29
)
30
30
import (
@@ -63,7 +63,10 @@ func (p *RpcClientPackageHandler) Read(ss getty.Session, data []byte) (interface
63
63
return nil , 0 , perrors .WithStack (err )
64
64
}
65
65
66
- return pkg , len (data ), nil
66
+ pkg .Err = pkg .Body .(* hessian.Response ).Exception
67
+ pkg .Body = pkg .Body .(* hessian.Response ).RspObj
68
+
69
+ return pkg , hessian .HEADER_LENGTH + pkg .Header .BodyLen , nil
67
70
}
68
71
69
72
func (p * RpcClientPackageHandler ) Write (ss getty.Session , pkg interface {}) error {
@@ -110,44 +113,47 @@ func (p *RpcServerPackageHandler) Read(ss getty.Session, data []byte) (interface
110
113
111
114
return nil , 0 , perrors .WithStack (err )
112
115
}
113
- // convert params of request
114
- req := pkg .Body .([]interface {}) // length of body should be 7
115
- if len (req ) > 0 {
116
- var dubboVersion , argsTypes string
117
- var args []interface {}
118
- var attachments map [interface {}]interface {}
119
- if req [0 ] != nil {
120
- dubboVersion = req [0 ].(string )
121
- }
122
- if req [1 ] != nil {
123
- pkg .Service .Path = req [1 ].(string )
124
- }
125
- if req [2 ] != nil {
126
- pkg .Service .Version = req [2 ].(string )
127
- }
128
- if req [3 ] != nil {
129
- pkg .Service .Method = req [3 ].(string )
130
- }
131
- if req [4 ] != nil {
132
- argsTypes = req [4 ].(string )
133
- }
134
- if req [5 ] != nil {
135
- args = req [5 ].([]interface {})
136
- }
137
- if req [6 ] != nil {
138
- attachments = req [6 ].(map [interface {}]interface {})
139
- }
140
- pkg .Service .Interface = attachments [constant .INTERFACE_KEY ].(string )
141
- pkg .Body = map [string ]interface {}{
142
- "dubboVersion" : dubboVersion ,
143
- "argsTypes" : argsTypes ,
144
- "args" : args ,
145
- "service" : common .ServiceMap .GetService (DUBBO , pkg .Service .Interface ),
146
- "attachments" : attachments ,
116
+
117
+ if pkg .Header .Type & hessian .PackageHeartbeat == 0x00 {
118
+ // convert params of request
119
+ req := pkg .Body .([]interface {}) // length of body should be 7
120
+ if len (req ) > 0 {
121
+ var dubboVersion , argsTypes string
122
+ var args []interface {}
123
+ var attachments map [interface {}]interface {}
124
+ if req [0 ] != nil {
125
+ dubboVersion = req [0 ].(string )
126
+ }
127
+ if req [1 ] != nil {
128
+ pkg .Service .Path = req [1 ].(string )
129
+ }
130
+ if req [2 ] != nil {
131
+ pkg .Service .Version = req [2 ].(string )
132
+ }
133
+ if req [3 ] != nil {
134
+ pkg .Service .Method = req [3 ].(string )
135
+ }
136
+ if req [4 ] != nil {
137
+ argsTypes = req [4 ].(string )
138
+ }
139
+ if req [5 ] != nil {
140
+ args = req [5 ].([]interface {})
141
+ }
142
+ if req [6 ] != nil {
143
+ attachments = req [6 ].(map [interface {}]interface {})
144
+ }
145
+ pkg .Service .Interface = attachments [constant .INTERFACE_KEY ].(string )
146
+ pkg .Body = map [string ]interface {}{
147
+ "dubboVersion" : dubboVersion ,
148
+ "argsTypes" : argsTypes ,
149
+ "args" : args ,
150
+ "service" : common .ServiceMap .GetService (DUBBO , pkg .Service .Interface ),
151
+ "attachments" : attachments ,
152
+ }
147
153
}
148
154
}
149
155
150
- return pkg , len ( data ) , nil
156
+ return pkg , hessian . HEADER_LENGTH + pkg . Header . BodyLen , nil
151
157
}
152
158
153
159
func (p * RpcServerPackageHandler ) Write (ss getty.Session , pkg interface {}) error {
0 commit comments