Переглянути джерело

handle empty payload in freedom and outbound

v2ray 9 роки тому
батько
коміт
66bb7879e0
2 змінених файлів з 7 додано та 3 видалено
  1. 3 1
      proxy/freedom/freedom.go
  2. 4 2
      proxy/vmess/outbound/outbound.go

+ 3 - 1
proxy/freedom/freedom.go

@@ -99,7 +99,9 @@ func (this *FreedomConnection) Dispatch(destination v2net.Destination, payload *
 	readMutex.Lock()
 	writeMutex.Lock()
 
-	conn.Write(payload.Value)
+	if !payload.IsEmpty() {
+		conn.Write(payload.Value)
+	}
 
 	go func() {
 		v2writer := v2io.NewAdaptiveWriter(conn)

+ 4 - 2
proxy/vmess/outbound/outbound.go

@@ -97,8 +97,10 @@ func (this *VMessOutboundHandler) handleRequest(session *encoding.ClientSession,
 	if request.Option.Has(protocol.RequestOptionChunkStream) {
 		streamWriter = vmessio.NewAuthChunkWriter(streamWriter)
 	}
-	if err := streamWriter.Write(payload); err != nil {
-		conn.SetReusable(false)
+	if !payload.IsEmpty() {
+		if err := streamWriter.Write(payload); err != nil {
+			conn.SetReusable(false)
+		}
 	}
 	writer.SetCached(false)