Browse Source

KCP: Fixed transport/config_json.go jsonConfig.KcpConfig, jsonConfig.KcpConfig.AdvancedConfig == nil

Shelikhoo 9 years ago
parent
commit
cbb183ec58
1 changed files with 5 additions and 1 deletions
  1. 5 1
      transport/config_json.go

+ 5 - 1
transport/config_json.go

@@ -23,6 +23,10 @@ func (this *Config) UnmarshalJSON(data []byte) error {
 	}
 	}
 	this.ConnectionReuse = jsonConfig.ConnectionReuse
 	this.ConnectionReuse = jsonConfig.ConnectionReuse
 	this.enableKcp = jsonConfig.EnableKcp
 	this.enableKcp = jsonConfig.EnableKcp
-	this.kcpConfig = kcpConfig
+	this.kcpConfig = jsonConfig.KcpConfig
+	if jsonConfig.KcpConfig.AdvancedConfig == nil {
+		jsonConfig.KcpConfig.AdvancedConfig = kcpv.DefaultAdvancedConfigs
+	}
+
 	return nil
 	return nil
 }
 }