Skip to content

Add PLM suspend and request-limit features to WinHTTP, removing XCurl GDK path - #1013

Open
Jason Sandlin (jasonsandlin) wants to merge 7 commits into
mainfrom
user/jasonsa/gdk-xcurl-pr
Open

Add PLM suspend and request-limit features to WinHTTP, removing XCurl GDK path#1013
Jason Sandlin (jasonsandlin) wants to merge 7 commits into
mainfrom
user/jasonsa/gdk-xcurl-pr

Conversation

@jasonsandlin

Copy link
Copy Markdown
Member

No description provided.

Comment thread Source/HTTP/WinHttp/winhttp_provider.cpp Outdated
Comment thread Source/HTTP/WinHttp/winhttp_provider.cpp
Comment thread Source/HTTP/WinHttp/winhttp_provider.cpp
Comment thread Source/Global/global_publics.cpp
RegisterAppStateChangeNotification was called under RETURN_IF_FAILED, so a
failure to subscribe took down HTTP entirely. That API resolves from
api-ms-win-core-psm-appnotify, which is not guaranteed to be present in every
configuration the GDK runs in, and suspend handling is a resilience feature
rather than a prerequisite for making requests.

The CurlProvider path this change set replaces already soft-failed here; this
restores that behavior for WinHTTP. On failure we log, leave the token null,
and continue without suspend notifications. The destructor already tolerates a
null token and Suspend/Resume simply never fire.

Addresses PR #1013 review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0d849a6b-2837-4f03-9b04-48dc22e535b4
CloseAllConnections cleared m_connections up front, so any connection that
failed to report closed within the bounded suspend wait was dropped from
tracking entirely. Shutdown then had nothing to wait on for those stragglers,
which defeats the INFINITE wait on the teardown path: the destructor could go
on to close the WinHTTP session handles a still-live connection was using.

Re-closing them is not an option. WinHttpConnection::Close is once-only and
returns E_UNEXPECTED on a second call without ever invoking the callback, so a
naive retry under INFINITE would hang forever.

Instead, retain the close context those connections were already given and wait
on it from a later call. That drain is deliberately bounded even when the caller
passed INFINITE: a connection that already missed one deadline is the one least
likely to ever report, and blocking HCCleanup forever would be worse than the
race it closes. The unbounded wait still applies to connections closed by the
current call, which is the case that actually protects the session handles.

Addresses PR #1013 review feedback.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0d849a6b-2837-4f03-9b04-48dc22e535b4
Comment thread Source/HTTP/WinHttp/winhttp_provider.cpp Outdated
Comment thread Source/HTTP/WinHttp/winhttp_provider.h Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

some food for thought. no hard blockers

Comment thread Source/HTTP/Curl/CurlMulti.cpp
Comment thread Build/libHttpClient.GDK/libHttpClient.GDK.def Outdated
Comment thread Source/Global/global.cpp Outdated
Comment thread Source/Global/global.cpp Outdated
Comment thread Include/httpClient/httpClient.h Outdated
Comment thread Source/HTTP/Curl/CurlMulti.h Outdated
Comment thread Source/HTTP/Curl/CurlMulti.h Outdated
Comment thread Tests/UnitTests/Tests/GlobalTests.cpp
Comment thread Source/HTTP/WinHttp/winhttp_provider.h Outdated
- Scope the default request limit to Xbox consoles. It is resolved at runtime via
  XSystemGetDeviceType because the same Gaming.Desktop binary ships on Xbox, GDK
  PC, Steam and Steam Deck. Those PC devices were never throttled before this
  change, so they stay unlimited unless a title opts in.
- Return E_NOTIMPL from HCSettingsSet/GetGlobalRequestLimit on platforms whose
  HTTP provider implements no admission control, rather than storing a value that
  would silently never throttle anything.
- Append the new exports to the end of all four .def files so existing ordinals
  are not shifted, matching the repo's additive-ABI convention.
- Gate the retained-connection drain to shutdown only; suspend stays bounded so
  the PLM watchdog cannot fire.
- Delete dead CurlMulti::PerformUntilDrained and ActiveRequestCount along with
  the includes they were the only users of.
- Correct the SessionKey comment (security level, not scheme), the request-limit
  comment, and the header docs so they match the code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0d849a6b-2837-4f03-9b04-48dc22e535b4
A non-static data member cannot be declared constexpr, so declaring
c_expectedDefaultRequestLimit inside the TAEF test class broke the ADO build.
Moved it to namespace scope rather than making it static constexpr, because this
project builds as C++14 by default and VERIFY_ARE_EQUAL takes its arguments by
const reference, which would odr-use the member and require an out-of-line
definition.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0d849a6b-2837-4f03-9b04-48dc22e535b4
c_consoleDefaultGlobalRequestLimit is only read inside the GDK branch of
DefaultGlobalRequestLimit, so at namespace scope it was an unused const on every
other platform. Apple and Linux build with -Werror, which broke the iOS leg.

Moved it into the GDK branch where it is used. c_unlimitedGlobalRequestLimit
stays at namespace scope because both branches return it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0d849a6b-2837-4f03-9b04-48dc22e535b4
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.

4 participants