From 1c8bf4067b881e5f21442882013d0617e4d5dc6d Mon Sep 17 00:00:00 2001 From: StarProxima <34741787+StarProxima@users.noreply.github.com> Date: Fri, 6 Nov 2026 21:45:23 +0300 Subject: [PATCH] XTLS Vision: Serialize VisionWriter writes from concurrent mux sessions (#7337) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/XTLS/Xray-core/pull/7337#issuecomment-6692618802 Fixes https://github.com/XTLS/Xray-core/issues/7336 --------- Co-authored-by: 风扇滑翔翼 Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com> --- proxy/proxy.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proxy/proxy.go b/proxy/proxy.go index 6008437eb..d57b47bce 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -13,6 +13,7 @@ import ( "math/big" "runtime" "strconv" + "sync" "time" "github.com/pires/go-proxyproto" @@ -301,6 +302,7 @@ type VisionWriter struct { // internal writeOnceUserUUID []byte directWriteCounter stats.Counter + access sync.Mutex testseed []uint32 } @@ -324,6 +326,9 @@ func NewVisionWriter(writer buf.Writer, trafficState *TrafficState, isUplink boo } func (w *VisionWriter) WriteMultiBuffer(mb buf.MultiBuffer) error { + w.access.Lock() + defer w.access.Unlock() + var isPadding *bool var switchToDirectCopy *bool var spliceReadyInbound *session.Inbound