| ... | ... | @@ -233,11 +233,12 @@ pub fn connect( |
| 233 | 233 | if (result) |stream| { |
| 234 | 234 | return stream; |
| 235 | 235 | } else |err| switch (err) { |
| 236 | error.Canceled => unreachable, |
| 237 | |
| 236 | 238 | error.SystemResources, |
| 237 | 239 | error.OptionUnsupported, |
| 238 | 240 | error.ProcessFdQuotaExceeded, |
| 239 | 241 | error.SystemFdQuotaExceeded, |
| 240 | | error.Canceled, |
| 241 | 242 | => |e| return e, |
| 242 | 243 | |
| 243 | 244 | error.WouldBlock => return error.Unexpected, |
| ... | ... | @@ -259,6 +260,8 @@ pub fn connect( |
| 259 | 260 | /// Asynchronously establishes a connection to all IP addresses associated with |
| 260 | 261 | /// a host name, adding them to a results queue upon completion. |
| 261 | 262 | /// |
| 263 | /// `error.Canceled` will never be added to the queue, but other errors may be. |
| 264 | /// |
| 262 | 265 | /// Closes `results` before return, even on error. |
| 263 | 266 | /// |
| 264 | 267 | /// Asserts `results` is not closed until this call returns. |
| ... | ... | @@ -299,22 +302,15 @@ fn enqueueConnection( |
| 299 | 302 | io: Io, |
| 300 | 303 | queue: *Io.Queue(IpAddress.ConnectError!Stream), |
| 301 | 304 | options: IpAddress.ConnectOptions, |
| 302 | | ) void { |
| 303 | | enqueueConnectionFallible(address, io, queue, options) catch |err| switch (err) { |
| 304 | | error.Canceled => {}, |
| 305 | | }; |
| 306 | | } |
| 307 | | fn enqueueConnectionFallible( |
| 308 | | address: IpAddress, |
| 309 | | io: Io, |
| 310 | | queue: *Io.Queue(IpAddress.ConnectError!Stream), |
| 311 | | options: IpAddress.ConnectOptions, |
| 312 | 305 | ) Io.Cancelable!void { |
| 313 | | const result = address.connect(io, options); |
| 306 | const result = address.connect(io, options) catch |err| switch (err) { |
| 307 | error.Canceled => |e| return e, |
| 308 | else => |e| e, // other errors go in the result queue |
| 309 | }; |
| 314 | 310 | errdefer if (result) |s| s.close(io) else |_| {}; |
| 315 | 311 | queue.putOne(io, result) catch |err| switch (err) { |
| 316 | | error.Closed => unreachable, // `queue` must not be closed |
| 317 | 312 | error.Canceled => |e| return e, |
| 313 | error.Closed => unreachable, // `queue` must not be closed |
| 318 | 314 | }; |
| 319 | 315 | } |
| 320 | 316 | |