Skip to content

fix: harden hooks, plugin lifecycle, and addon download failure handling - #7

Open
M-archand wants to merge 4 commits into
SwiftlyS2-Plugins:masterfrom
M-archand:dev
Open

M-archand wants to merge 4 commits into
SwiftlyS2-Plugins:masterfrom
M-archand:dev

Conversation

@M-archand

Copy link
Copy Markdown

Some hardening fixes for potential crashes, leaks, and retry loops.

Prevent unhandled exceptions (9373c06)

No try/catch anywhere despite doing unsafe pointer reads, Steam API calls, and per-client hook work. All 12 entry points now catch, log with context, and return a safe default.

Clean up plugin state on unload (3070cd1)

Unload() was empty and the ServiceProvider was never disposed. So leaked the Steam Callback<T> & the addon search paths added via AddSearchPath.

Check Steam error message lookup (85f3c1c)

SteamErrorMessage.Errors holds 133 entries and was indexed directly by the raw EResult, so any code Valve adds beyond that in the future will throw IndexOutOfRangeException inside the download failure handler.

Stop failed downloads from looping the map forever (29694f8)

OnAddonDownloaded cleared the addon from ImportantDownloads regardless of result, so a failure took the success path and called ReloadMap(), which raised OnStartupServer, re-ran RefreshAddons, re-queued the same addon, and failed again indefinitely. Failures are still retried on the next map load.

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.

1 participant