mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-15 10:29:04 +00:00
ea3badc641
The root cause was architectural: each peer connection created a goroutine that competed for the same readQueue. When a goroutine grabbed a read request but its connection had no data, it would block, preventing other peers from receiving packets. This caused the "only one peer works at a time" behavior. Solution: Redesigned the packet flow: - Each peer connection now continuously reads from its socket and sends packets to a shared packetQueue - A dispatcher goroutine matches readQueue requests (from WireGuard) with packets from packetQueue - This allows all peer connections to work simultaneously without blocking Changes: - Added packetQueue channel and receivedPacket struct to buffer packets - Modified Open() to start a dispatcher goroutine - Rewrote connectTo() to continuously read and queue packets - Each peer connection now operates independently Tests pass. This architectural fix addresses the fundamental issue with multi-peer WireGuard support. Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>