DNS outbound: Add lock to TCP DNS handler (#7473)

Fixes https://github.com/XTLS/Xray-core/issues/7462
This commit is contained in:
风扇滑翔翼
2026-11-24 11:14:39 +00:00
committed by GitHub
parent 4dac768567
commit 8c7447fd2d
+3
View File
@@ -128,6 +128,7 @@ func (w *UDPWriter) WriteMessage(b *buf.Buffer) error {
type TCPWriter struct {
buf.Writer
sync.Mutex
}
func (w *TCPWriter) WriteMessage(b *buf.Buffer) error {
@@ -140,5 +141,7 @@ func (w *TCPWriter) WriteMessage(b *buf.Buffer) error {
size := buf.New()
binary.BigEndian.PutUint16(size.Extend(2), uint16(b.Len()))
mb = append(mb, size, b)
w.Lock()
defer w.Unlock()
return w.WriteMultiBuffer(mb)
}