mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-12-01 14:18:38 +00:00
XTLS Vision: Serialize VisionWriter writes from concurrent mux sessions (#7337)
https://github.com/XTLS/Xray-core/pull/7337#issuecomment-6692618802 Fixes https://github.com/XTLS/Xray-core/issues/7336 --------- Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com> Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
co-authored by
风扇滑翔翼
RPRX
parent
2e4c13d8c4
commit
1c8bf4067b
@@ -13,6 +13,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pires/go-proxyproto"
|
"github.com/pires/go-proxyproto"
|
||||||
@@ -301,6 +302,7 @@ type VisionWriter struct {
|
|||||||
// internal
|
// internal
|
||||||
writeOnceUserUUID []byte
|
writeOnceUserUUID []byte
|
||||||
directWriteCounter stats.Counter
|
directWriteCounter stats.Counter
|
||||||
|
access sync.Mutex
|
||||||
|
|
||||||
testseed []uint32
|
testseed []uint32
|
||||||
}
|
}
|
||||||
@@ -324,6 +326,9 @@ func NewVisionWriter(writer buf.Writer, trafficState *TrafficState, isUplink boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *VisionWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
func (w *VisionWriter) WriteMultiBuffer(mb buf.MultiBuffer) error {
|
||||||
|
w.access.Lock()
|
||||||
|
defer w.access.Unlock()
|
||||||
|
|
||||||
var isPadding *bool
|
var isPadding *bool
|
||||||
var switchToDirectCopy *bool
|
var switchToDirectCopy *bool
|
||||||
var spliceReadyInbound *session.Inbound
|
var spliceReadyInbound *session.Inbound
|
||||||
|
|||||||
Reference in New Issue
Block a user