This is an automated email from the ASF dual-hosted git repository.

joezou pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/develop by this push:
     new c5d87d4  make proxy_factory.ProxyInvoker can be extended
     new d2e48f0  Merge pull request #747 from cvictory/proxy_invoker_fix
c5d87d4 is described below

commit c5d87d431aaed50df5ce4f998de5a3daba79da64
Author: cvictory <[email protected]>
AuthorDate: Thu Sep 10 19:31:50 2020 +0800

    make proxy_factory.ProxyInvoker can be extended
---
 common/proxy/proxy_factory/default.go | 9 +++++++++
 registry/protocol/protocol.go         | 3 ---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/common/proxy/proxy_factory/default.go 
b/common/proxy/proxy_factory/default.go
index 1b8ca22..752f3ea 100644
--- a/common/proxy/proxy_factory/default.go
+++ b/common/proxy/proxy_factory/default.go
@@ -89,6 +89,8 @@ func (pi *ProxyInvoker) Invoke(ctx context.Context, 
invocation protocol.Invocati
        result.SetAttachments(invocation.Attachments())
 
        url := pi.GetUrl()
+       //get providerUrl. The origin url may be is registry URL.
+       url = *getProviderURL(&url)
 
        methodName := invocation.MethodName()
        proto := url.Protocol
@@ -159,3 +161,10 @@ func (pi *ProxyInvoker) Invoke(ctx context.Context, 
invocation protocol.Invocati
        }
        return result
 }
+
+func getProviderURL(url *common.URL) *common.URL {
+       if url.SubURL == nil {
+               return url
+       }
+       return url.SubURL
+}
diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go
index d313e48..69a31ef 100644
--- a/registry/protocol/protocol.go
+++ b/registry/protocol/protocol.go
@@ -32,7 +32,6 @@ import (
        "github.com/apache/dubbo-go/common/constant"
        "github.com/apache/dubbo-go/common/extension"
        "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_center"
        _ "github.com/apache/dubbo-go/config_center/configurator"
@@ -408,8 +407,6 @@ func newWrappedInvoker(invoker protocol.Invoker, url 
*common.URL) *wrappedInvoke
 
 // Invoke remote service base on URL of wrappedInvoker
 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)
 }
 

Reply via email to