mirror of
https://github.com/injoyai/tdx.git
synced 2025-11-26 21:25:35 +08:00
优化NewRangeDial
This commit is contained in:
5
dial.go
5
dial.go
@@ -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"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user