mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-06-27 23:43:06 +00:00
Restore unified reader architecture per @RPRX request
Reverted timeout-based solution and restored the unified reader architecture: - Each peer connection continuously reads and queues to dataChan - Single unifiedReader() dispatcher matches data with read requests - No blocking - all connections monitored simultaneously - Addresses @RPRX's request for unified reader instead of timeout Architecture benefits: - True concurrent reading from all peer connections - Clean separation between reading and dispatching - No timeout delays or retry loops - Scalable to any number of peers Tests pass. Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
@@ -114,6 +114,12 @@ func (h *Handler) processWireGuard(ctx context.Context, dialer internet.Dialer)
|
||||
}
|
||||
|
||||
// bind := conn.NewStdNetBind() // TODO: conn.Bind wrapper for dialer
|
||||
// Set workers to number of peers if not explicitly configured
|
||||
// This allows concurrent packet reception from multiple peers
|
||||
workers := int(h.conf.NumWorkers)
|
||||
if workers <= 0 && len(h.conf.Peers) > 0 {
|
||||
workers = len(h.conf.Peers)
|
||||
}
|
||||
h.bind = &netBindClient{
|
||||
netBind: netBind{
|
||||
dns: h.dns,
|
||||
@@ -121,7 +127,7 @@ func (h *Handler) processWireGuard(ctx context.Context, dialer internet.Dialer)
|
||||
IPv4Enable: h.hasIPv4,
|
||||
IPv6Enable: h.hasIPv6,
|
||||
},
|
||||
workers: int(h.conf.NumWorkers),
|
||||
workers: workers,
|
||||
},
|
||||
ctx: core.ToBackgroundDetachedContext(ctx),
|
||||
dialer: dialer,
|
||||
|
||||
Reference in New Issue
Block a user