You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/01 05:18:39 UTC

[GitHub] [dubbo-go] Mulavar commented on a change in pull request #1425: feat(config): add new protocol config

Mulavar commented on a change in pull request #1425:
URL: https://github.com/apache/dubbo-go/pull/1425#discussion_r699851006



##########
File path: remoting/getty/getty_client.go
##########
@@ -59,27 +59,30 @@ func initClient(protocol string) {
 		return
 	}
 
-	// load clientconfig from consumer_config
+	// load client config from rootConfig.Protocols
 	// default use dubbo
 	if config.GetApplicationConfig() == nil {
 		return
 	}
-	protocolConf := config.GetRootConfig().Network
+	if config.GetRootConfig().Protocols == nil {
+		return
+	}
+
+	protocolConf := config.GetRootConfig().Protocols[protocol]
 	defaultClientConfig := GetDefaultClientConfig()
 	if protocolConf == nil {
-		logger.Info("protocol_conf default use dubbo config")
+		logger.Info("use default getty client config")
 	} else {
-		//dubboConf := protocolConf.(map[interface{}]interface{})[protocol]
-		dubboConf := protocolConf[protocol]
-		if dubboConf == nil {
-			logger.Warnf("dubboConf is nil")
+		gettyClientConfig := protocolConf.Params
+		if gettyClientConfig == nil {
+			logger.Warnf("gettyClientConfig is nil")
 			return
 		}
-		dubboConfByte, err := yaml.Marshal(dubboConf)
+		gettyClientConfigBytes, err := yaml.Marshal(gettyClientConfig)

Review comment:
       测了一下,这里反序列化的对象是defaultClientConfig,defaultClientConfig本身已经有默认值了,所以marshal后做unmarshal时,如果gettyClientConfig有些参数没设置,会直接使用defaultClientConfig已有的默认值,跟dubbo url的结果是一致的。




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org