| ... | @@ -440,13 +440,11 @@ pub const Loop = struct { | ... | @@ -440,13 +440,11 @@ pub const Loop = struct { |
| 440 | .overlapped = ResumeNode.overlapped_init, | 440 | .overlapped = ResumeNode.overlapped_init, |
| 441 | }, | 441 | }, |
| 442 | }; | 442 | }; |
| 443 | var need_to_delete = false; | 443 | var need_to_delete = true; |
| 444 | defer if (need_to_delete) self.linuxRemoveFd(fd); | 444 | defer if (need_to_delete) self.linuxRemoveFd(fd); |
| 445 | | 445 | |
| 446 | suspend { | 446 | suspend { |
| 447 | if (self.linuxAddFd(fd, &resume_node.base, flags)) |_| { | 447 | self.linuxAddFd(fd, &resume_node.base, flags) catch |err| switch (err) { |
| 448 | need_to_delete = true; | | |
| 449 | } else |err| switch (err) { | | |
| 450 | error.FileDescriptorNotRegistered => unreachable, | 448 | error.FileDescriptorNotRegistered => unreachable, |
| 451 | error.OperationCausesCircularLoop => unreachable, | 449 | error.OperationCausesCircularLoop => unreachable, |
| 452 | error.FileDescriptorIncompatibleWithEpoll => unreachable, | 450 | error.FileDescriptorIncompatibleWithEpoll => unreachable, |
| ... | @@ -456,6 +454,7 @@ pub const Loop = struct { | ... | @@ -456,6 +454,7 @@ pub const Loop = struct { |
| 456 | error.UserResourceLimitReached, | 454 | error.UserResourceLimitReached, |
| 457 | error.Unexpected, | 455 | error.Unexpected, |
| 458 | => { | 456 | => { |
| | 457 | need_to_delete = false; |
| 459 | // Fall back to a blocking poll(). Ideally this codepath is never hit, since | 458 | // Fall back to a blocking poll(). Ideally this codepath is never hit, since |
| 460 | // epoll should be just fine. But this is better than incorrect behavior. | 459 | // epoll should be just fine. But this is better than incorrect behavior. |
| 461 | var poll_flags: i16 = 0; | 460 | var poll_flags: i16 = 0; |
| ... | @@ -479,7 +478,7 @@ pub const Loop = struct { | ... | @@ -479,7 +478,7 @@ pub const Loop = struct { |
| 479 | }; | 478 | }; |
| 480 | resume @frame(); | 479 | resume @frame(); |
| 481 | }, | 480 | }, |
| 482 | } | 481 | }; |
| 483 | } | 482 | } |
| 484 | } | 483 | } |
| 485 | | 484 | |