Skip to content

Service port forwarding and is_connected() periodically during traffic - #198

Open
edi-oai wants to merge 1 commit into
mainfrom
dev/edi/periodic-port-forwarding
Open

Service port forwarding and is_connected() periodically during traffic#198
edi-oai wants to merge 1 commit into
mainfrom
dev/edi/periodic-port-forwarding

Conversation

@edi-oai

@edi-oai edi-oai commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Problem

Continuous traffic could prevent periodic port-forwarding maintenance from running.

Conditions like:

  • !vm_readable && !host_readable && !interrupt
  • self.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::Instant in Poller and expose periodic_tick_due().

Port forwarding maintenance and is_connected() check now runs when the interval elapses, regardless of poll readiness events.

@edi-oai edi-oai changed the title Service port forwarding periodically during traffic Service port forwarding and is_connected periodically during traffic Aug 17, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread lib/proxy/mod.rs
Comment on lines +137 to 139
if self.poller.periodic_tick_due() {
self.port_forwarder
.tick(&mut self.host, self.dhcp_snooper.lease());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@edi-oai edi-oai changed the title Service port forwarding and is_connected periodically during traffic Service port forwarding and is_connected() periodically during traffic Aug 17, 2026
@edi-oai
edi-oai force-pushed the dev/edi/periodic-port-forwarding branch from 61d4593 to df0874b Compare August 17, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants