app/reverse/bridge.go: Fix DispatchLink() returns immediately

Fixes https://github.com/XTLS/Xray-core/issues/5088
pull/5090/head
RPRX 2025-09-05 15:58:49 +00:00 committed by GitHub
parent 118131fcaf
commit 6ec0291d4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 14 additions and 16 deletions

View File

@ -149,7 +149,6 @@ func (w *BridgeWorker) Connections() uint32 {
} }
func (w *BridgeWorker) handleInternalConn(link *transport.Link) { func (w *BridgeWorker) handleInternalConn(link *transport.Link) {
go func() {
reader := link.Reader reader := link.Reader
for { for {
mb, err := reader.ReadMultiBuffer() mb, err := reader.ReadMultiBuffer()
@ -167,7 +166,6 @@ func (w *BridgeWorker) handleInternalConn(link *transport.Link) {
} }
} }
} }
}()
} }
func (w *BridgeWorker) Dispatch(ctx context.Context, dest net.Destination) (*transport.Link, error) { func (w *BridgeWorker) Dispatch(ctx context.Context, dest net.Destination) (*transport.Link, error) {
@ -182,7 +180,7 @@ func (w *BridgeWorker) Dispatch(ctx context.Context, dest net.Destination) (*tra
uplinkReader, uplinkWriter := pipe.New(opt...) uplinkReader, uplinkWriter := pipe.New(opt...)
downlinkReader, downlinkWriter := pipe.New(opt...) downlinkReader, downlinkWriter := pipe.New(opt...)
w.handleInternalConn(&transport.Link{ go w.handleInternalConn(&transport.Link{
Reader: downlinkReader, Reader: downlinkReader,
Writer: uplinkWriter, Writer: uplinkWriter,
}) })