Skip to content

Fix UPnP IGD detection - #689

Merged
ReenigneArcher merged 2 commits into
SunshineStream:nightlyfrom
BigBrainAFK:fix/upnp-igd-status
Jan 3, 2023
Merged

ReenigneArcher merged 2 commits into
SunshineStream:nightlyfrom
BigBrainAFK:fix/upnp-igd-status

Conversation

@BigBrainAFK

@BigBrainAFK BigBrainAFK commented Jan 3, 2023 •

Copy link
Copy Markdown
Contributor

Description

This PR fixes the UPnP status messages and allows the detection of UPnP iuds that are in status 2 (not connected)

An IGD in status 1 is the IGD of the network and connected (has an external IP which isn't in a private block)
An IGD in status 2 is also the IGD of the network but may not be connected due to various reasons (no external IP or external IP in a private IPv4/IPv6 block)

Sunshine should not discard an IGD of status 2 as the reason to the unconnected status is not determinable by an outside source and has to be fixed by the network administrator/owner. This can be a misconfigured second router or just the ISP being down due to various reasons.

We still do not attempt to open ports on a status 3 as this is just a UPnP device which is not an IGD.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Dependency update (updates to dependencies)
  • Documentation update (changes to documentation)
  • Repository update (changes to repository files, e.g. .github/...)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch
must be updated before it can be merged. You must also
Allow edits from maintainers.

  • I want maintainers to keep my branch updated

@CLAassistant

CLAassistant commented Jan 3, 2023 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ReenigneArcher
ReenigneArcher merged commit 30a790b into SunshineStream:nightly Jan 3, 2023
Nonary pushed a commit to Nonary/vibeshine that referenced this pull request Nov 12, 2026
…m#689)

* fix(playnite): back off and rate-limit pipe reconnects

When the pre-0.5 script connector (SunshinePlaynite.psm1) is still
installed next to Playnite.DesktopApp.exe, Playnite loads it alongside the
compiled plugin. Both serve the single-instance pipe
Sunshine.PlayniteExtension, so the one that does not own the name gets
ERROR_PIPE_BUSY from NamedPipeServerStream immediately. The accept loop
retried with no delay and logged a WARN every ~1 ms to extensions.log and
sunshine_playnite-*.log, growing them by gigabytes and keeping Defender's
real-time scanner busy.

Plugin:
- Back off after a failed accept attempt: 250 ms doubling to 10 s with
  jitter, reset on a successful accept; the wait ends on Stop().
- Log the first failure of a run, then at most one summary per 60 s, and
  note recovery once a client is accepted.
- Explain ERROR_PIPE_BUSY: another process owns the pipe, usually a second
  copy of the connector.
- At startup, warn about any SunshinePlaynite.psm1 in Playnite's
  Extensions folders.

Sunshine (IpcClient, also used by playnite-launcher):
- Replace the fixed 500/300 ms reconnect sleeps with the same backoff; it
  resets only after a connection stays up for 5 s, so a connect-and-drop
  loop cannot spin either. Sleeps return promptly on stop().
- Rate-limit connect-failure logging the same way, with the Win32 error.
- Add NamedPipeFactory::set_quiet_connect_failures() so per-attempt
  "pipe not found/busy" logs drop to debug for callers that report
  failures themselves, and last_connect_error() so the real error is
  reported instead of a GetLastError() clobbered by logging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(playnite): update pipe fixtures for the reconnect backoff

The identification and virtual-display transport fixtures extract code from
pipes.cpp and playnite_ipc.cpp, so they broke on the new connect_to_plugin
signature and the factory's quiet-failure state. Carry that state into both
fixtures and assert the connect error is reported on failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Vibeshine adaptation: preserve the existing ConnectorRetryPolicy server
backoff and logging semantics, private IPC security contracts and their tests.
Port native client backoff and legacy connector warning; extend the native
fixture to check jitter bounds, exponential growth, cap and reset.

(cherry picked from commit b739553a9653fa1b2a288f7e3ab2321ab1a0c3a4)
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.

3 participants