mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-14 10:00:34 +00:00
Hysteria outbound: Fix ContextWithRequireDatagram() (#5558)
Fixes https://github.com/XTLS/Xray-core/pull/5549
This commit is contained in:
@@ -56,10 +56,7 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
|
|||||||
ob.CanSpliceCopy = 3
|
ob.CanSpliceCopy = 3
|
||||||
target := ob.Target
|
target := ob.Target
|
||||||
|
|
||||||
if target.Network == net.Network_UDP {
|
conn, err := dialer.Dial(hyCtx.ContextWithRequireDatagram(ctx, target.Network == net.Network_UDP), c.server.Destination)
|
||||||
hyCtx.ContextWithRequireDatagram(ctx)
|
|
||||||
}
|
|
||||||
conn, err := dialer.Dial(ctx, c.server.Destination)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New("failed to find an available destination").AtWarning().Base(err)
|
return errors.New("failed to find an available destination").AtWarning().Base(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ const (
|
|||||||
requireDatagram key = iota
|
requireDatagram key = iota
|
||||||
)
|
)
|
||||||
|
|
||||||
func ContextWithRequireDatagram(ctx context.Context) context.Context {
|
func ContextWithRequireDatagram(ctx context.Context, udp bool) context.Context {
|
||||||
|
if !udp {
|
||||||
|
return ctx
|
||||||
|
}
|
||||||
return context.WithValue(ctx, requireDatagram, struct{}{})
|
return context.WithValue(ctx, requireDatagram, struct{}{})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user