浏览代码

Merge branch 'master' of https://github.com/v2ray/v2ray-core

v2ray 9 年之前
父节点
当前提交
666dff02b0
共有 3 个文件被更改,包括 7 次插入2 次删除
  1. 2 0
      transport/config.go
  2. 3 1
      transport/config_json.go
  3. 2 1
      transport/transport.go

+ 2 - 0
transport/config.go

@@ -1,9 +1,11 @@
 package transport
 
+// Config for V2Ray transport layer.
 type Config struct {
 	ConnectionReuse bool
 }
 
+// Apply applies this Config.
 func (this *Config) Apply() error {
 	if this.ConnectionReuse {
 		connectionReuse = true

+ 3 - 1
transport/config_json.go

@@ -8,7 +8,9 @@ func (this *Config) UnmarshalJSON(data []byte) error {
 	type JsonConfig struct {
 		ConnectionReuse bool `json:"connectionReuse"`
 	}
-	jsonConfig := new(JsonConfig)
+	jsonConfig := &JsonConfig{
+		ConnectionReuse: true,
+	}
 	if err := json.Unmarshal(data, jsonConfig); err != nil {
 		return err
 	}

+ 2 - 1
transport/transport.go

@@ -1,9 +1,10 @@
 package transport
 
 var (
-	connectionReuse = false
+	connectionReuse = true
 )
 
+// IsConnectionReusable returns true if V2Ray is trying to reuse TCP connections.
 func IsConnectionReusable() bool {
 	return connectionReuse
 }