Service port forwarding and is_connected() periodically during traffic - #198
Service port forwarding and is_connected() periodically during traffic#198edi-oai wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61d45931bf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if self.poller.periodic_tick_due() { | ||
| self.port_forwarder | ||
| .tick(&mut self.host, self.dhcp_snooper.lease()); |
There was a problem hiding this comment.
Run periodic maintenance inside unbounded drain loops
When VM or host traffic arrives continuously enough that read_from_vm never observes WouldBlock, or read_from_host never observes VmnetReadNothing, these unbounded drain loops never return to this check. Since this remains the only port_forwarder.tick call in the repository, forwarding installation, updates, and lease-expiry cleanup can still be postponed indefinitely under the sustained-traffic condition this change is intended to handle; check the deadline while draining packets or otherwise bound each drain iteration.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Let's handle this separately in #199.
Again, this seems out-of-scope because this PR didn't introduce this issue in the first place.
61d4593 to
df0874b
Compare
Problem
Continuous traffic could prevent periodic port-forwarding maintenance from running.
Conditions like:
!vm_readable && !host_readable && !interruptself.events.is_empty()...only detect an idle poll wake, not whether the timeout interval has elapsed.
Additionally, we run
is_connected()for each loop cycle, which might be too much.Solution
Track the periodic interval with
coarsetime::InstantinPollerand exposeperiodic_tick_due().Port forwarding maintenance and
is_connected()check now runs when the interval elapses, regardless of poll readiness events.