Skip to content
Snippets Groups Projects
Commit c3ad99b6 authored by fangyincheng's avatar fangyincheng
Browse files

Mod:fix bug

parent ae9a2d59
No related branches found
No related tags found
No related merge requests found
......@@ -93,7 +93,7 @@ func initClient(clientConfig *examples.ClientConfig) {
}
for _, service := range clientConfig.Service_List {
err = clientRegistry.RegisterConsumer(&service)
err = clientRegistry.RegisterConsumer(service)
if err != nil {
panic(fmt.Sprintf("registry.Register(service{%#v}) = error{%v}", service, jerrors.ErrorStack(err)))
return
......
......@@ -96,7 +96,7 @@ func initClient(clientConfig *examples.ClientConfig) {
}
for _, service := range clientConfig.Service_List {
err = clientRegistry.RegisterConsumer(&service)
err = clientRegistry.RegisterConsumer(service)
if err != nil {
panic(fmt.Sprintf("registry.Register(service{%#v}) = error{%v}", service, jerrors.ErrorStack(err)))
return
......
......@@ -3,6 +3,7 @@ package main
import (
"context"
"fmt"
"github.com/dubbo/dubbo-go/registry"
_ "net/http/pprof"
)
......@@ -14,7 +15,6 @@ import (
"github.com/dubbo/dubbo-go/examples"
"github.com/dubbo/dubbo-go/jsonrpc"
"github.com/dubbo/dubbo-go/public"
"github.com/dubbo/dubbo-go/service"
)
func testJsonrpc(clientConfig *examples.ClientConfig, userKey string, method string) {
......@@ -24,7 +24,7 @@ func testJsonrpc(clientConfig *examples.ClientConfig, userKey string, method str
serviceIdx int
user *JsonRPCUser
ctx context.Context
conf service.ServiceConfig
conf registry.ServiceConfig
req jsonrpc.Request
)
......@@ -42,7 +42,7 @@ func testJsonrpc(clientConfig *examples.ClientConfig, userKey string, method str
// Create request
// gxlog.CInfo("jsonrpc selected service %#v", clientConfig.Service_List[serviceIdx])
conf = service.ServiceConfig{
conf = registry.ServiceConfig{
Group: clientConfig.Service_List[serviceIdx].Group,
Protocol: public.CodecType(public.CODECTYPE_JSONRPC).String(),
Version: clientConfig.Service_List[serviceIdx].Version,
......
......@@ -19,10 +19,10 @@ func (r *ZkRegistry) RegisterConsumer(regConf registry.ServiceConfigIf) error {
ok bool
err error
listener *zkEventListener
conf *registry.ServiceConfig
conf registry.ServiceConfig
)
if conf, ok = regConf.(*registry.ServiceConfig); !ok {
if conf, ok = regConf.(registry.ServiceConfig); !ok {
return jerrors.Errorf("the type of @regConf %T is not registry.ServiceConfig", regConf)
}
......@@ -48,7 +48,7 @@ func (r *ZkRegistry) RegisterConsumer(regConf registry.ServiceConfigIf) error {
listener = r.listener
r.listenerLock.Unlock()
if listener != nil {
go listener.listenServiceEvent(conf)
go listener.listenServiceEvent(&conf)
}
return nil
......
......@@ -278,7 +278,7 @@ func (r *ZkRegistry) register(c registry.ServiceConfigIf) error {
if r.DubboType == registry.PROVIDER {
conf, ok := c.(registry.ProviderServiceConfig)
if !ok {
return fmt.Errorf("the type of @c:%+v is not *registry.ProviderServiceConfig", c)
return fmt.Errorf("the type of @c:%+v is not registry.ProviderServiceConfig", c)
}
if conf.Service == "" || conf.Methods == "" {
......@@ -331,9 +331,9 @@ func (r *ZkRegistry) register(c registry.ServiceConfigIf) error {
log.Debug("provider path:%s, url:%s", dubboPath, rawURL)
} else if r.DubboType == registry.CONSUMER {
conf, ok := c.(*registry.ServiceConfig)
if ok {
return fmt.Errorf("the type of @c:%+v is not *registry.ServiceConfig", c)
conf, ok := c.(registry.ServiceConfig)
if !ok {
return fmt.Errorf("the type of @c:%+v is not registry.ServiceConfig", c)
}
dubboPath = fmt.Sprintf("/dubbo/%s/%s", conf.Service, registry.DubboNodes[registry.CONSUMER])
......
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