Skip to content
Snippets Groups Projects
Commit b7e153ea authored by 邹毅贤's avatar 邹毅贤
Browse files

Merge pull request #747 from cvictory/proxy_invoker_fix

ProxyInvoker cannot be extended
parent 637e4611
No related branches found
No related tags found
No related merge requests found
...@@ -89,6 +89,8 @@ func (pi *ProxyInvoker) Invoke(ctx context.Context, invocation protocol.Invocati ...@@ -89,6 +89,8 @@ func (pi *ProxyInvoker) Invoke(ctx context.Context, invocation protocol.Invocati
result.SetAttachments(invocation.Attachments()) result.SetAttachments(invocation.Attachments())
url := pi.GetUrl() url := pi.GetUrl()
//get providerUrl. The origin url may be is registry URL.
url = *getProviderURL(&url)
methodName := invocation.MethodName() methodName := invocation.MethodName()
proto := url.Protocol proto := url.Protocol
...@@ -159,3 +161,10 @@ func (pi *ProxyInvoker) Invoke(ctx context.Context, invocation protocol.Invocati ...@@ -159,3 +161,10 @@ func (pi *ProxyInvoker) Invoke(ctx context.Context, invocation protocol.Invocati
} }
return result return result
} }
func getProviderURL(url *common.URL) *common.URL {
if url.SubURL == nil {
return url
}
return url.SubURL
}
...@@ -32,7 +32,6 @@ import ( ...@@ -32,7 +32,6 @@ import (
"github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/extension"
"github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/common/logger"
"github.com/apache/dubbo-go/common/proxy/proxy_factory"
"github.com/apache/dubbo-go/config" "github.com/apache/dubbo-go/config"
"github.com/apache/dubbo-go/config_center" "github.com/apache/dubbo-go/config_center"
_ "github.com/apache/dubbo-go/config_center/configurator" _ "github.com/apache/dubbo-go/config_center/configurator"
...@@ -403,8 +402,6 @@ func newWrappedInvoker(invoker protocol.Invoker, url *common.URL) *wrappedInvoke ...@@ -403,8 +402,6 @@ func newWrappedInvoker(invoker protocol.Invoker, url *common.URL) *wrappedInvoke
// Invoke remote service base on URL of wrappedInvoker // Invoke remote service base on URL of wrappedInvoker
func (ivk *wrappedInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result { func (ivk *wrappedInvoker) Invoke(ctx context.Context, invocation protocol.Invocation) protocol.Result {
// get right url
ivk.invoker.(*proxy_factory.ProxyInvoker).BaseInvoker = *protocol.NewBaseInvoker(ivk.GetUrl())
return ivk.invoker.Invoke(ctx, invocation) return ivk.invoker.Invoke(ctx, invocation)
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment