Skip to content
Permalink
Browse files

Merge pull request #130 from fangyincheng/master

Fix: dubbo version
  • Loading branch information...
AlexStocks committed Sep 9, 2019
2 parents 1ed0a12 + cfbb8e8 commit 80cbb25cbb227c0cf5e3d0ef186b207534646148
Showing with 7 additions and 10 deletions.
  1. +5 −5 request.go
  2. +2 −5 response.go
@@ -176,7 +176,6 @@ func packRequest(service Service, header DubboHeader, req interface{}) ([]byte,
err error
types string
byteArray []byte
version string
pkgLen int
)

@@ -220,8 +219,9 @@ func packRequest(service Service, header DubboHeader, req interface{}) ([]byte,
goto END
}

// https://github.com/apache/dubbo/blob/dubbo-2.7.1/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeChannel.java#L92
// dubbo version + path + version + method
encoder.Encode(DUBBO_VERSION)
encoder.Encode(DEFAULT_DUBBO_PROTOCOL_VERSION)
encoder.Encode(service.Path)
encoder.Encode(service.Version)
encoder.Encode(service.Method)
@@ -238,9 +238,8 @@ func packRequest(service Service, header DubboHeader, req interface{}) ([]byte,
request.Attachments[PATH_KEY] = service.Path
request.Attachments[GROUP_KEY] = service.Group
request.Attachments[INTERFACE_KEY] = service.Interface
if len(version) != 0 {
request.Attachments[VERSION_KEY] = version
}
request.Attachments[VERSION_KEY] = service.Version

if service.Timeout != 0 {
request.Attachments[TIMEOUT_KEY] = strconv.Itoa(int(service.Timeout / time.Millisecond))
}
@@ -325,6 +324,7 @@ func unpackRequestBody(decoder *Decoder, reqObj interface{}) error {
return perrors.WithStack(err)
}
if v, ok := attachments.(map[interface{}]interface{}); ok {
v[DUBBO_VERSION_KEY] = dubboVersion
req[6] = ToMapStringString(v)
return nil
}
@@ -58,8 +58,7 @@ func EnsureResponse(body interface{}) *Response {
return NewResponse(body, nil, nil)
}

// dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/codec/ExchangeCodec.java
// v2.7.1 line 256 encodeResponse
// https://github.com/apache/dubbo/blob/dubbo-2.7.1/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/codec/ExchangeCodec.java#L256
// hessian encode response
func packResponse(header DubboHeader, ret interface{}) ([]byte, error) {
var (
@@ -332,10 +331,8 @@ func ReflectResponse(in interface{}, out interface{}) error {

var versionInt = make(map[string]int)

// https://github.com/apache/dubbo/blob/dubbo-2.7.1/dubbo-common/src/main/java/org/apache/dubbo/common/Version.java#L96
// isSupportResponseAttachment is for compatibility among some dubbo version
// but we haven't used it yet.
// dubbo-common/src/main/java/org/apache/dubbo/common/Version.java
// v2.7.1 line 96
func isSupportResponseAttachment(version string) bool {
if version == "" {
return false

0 comments on commit 80cbb25

Please sign in to comment.
You can’t perform that action at this time.