优化NewRangeDial

This commit is contained in:
injoyai
2025-03-18 15:02:36 +08:00
parent 0cfd21f8fb
commit b4f748306a

View File

@@ -51,6 +51,11 @@ func NewRangeDial(hosts []string) ios.DialFunc {
} }
return func(ctx context.Context) (c ios.ReadWriteCloser, _ string, err error) { return func(ctx context.Context) (c ios.ReadWriteCloser, _ string, err error) {
for i, addr := range hosts { for i, addr := range hosts {
select {
case <-ctx.Done():
return nil, "", ctx.Err()
default:
}
if !strings.Contains(addr, ":") { if !strings.Contains(addr, ":") {
addr += ":7709" addr += ":7709"
} }