diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index 089639fe..3f30b8af 100644 --- a/proxy/freedom/freedom.go +++ b/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) diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index 16aef5a8..27b44f00 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/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)