Skip to content

Add RCON server support and related inventory/config updates#16

Merged
GT-610 merged 9 commits into
mainfrom
rcon
Jul 9, 2026
Merged

Add RCON server support and related inventory/config updates#16
GT-610 merged 9 commits into
mainfrom
rcon

Conversation

@GT-610

@GT-610 GT-610 commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add an RCON server implementation and wire it into the GC/client runtime.
  • Extend config, networking, and platform code to support the new RCON flow.
  • Update inventory, item schema, souvenir, and graffiti handling to align with the new behavior.
  • Refresh build/docs files and example config to describe the new functionality.

Testing

  • Not run (not requested)
  • Build and runtime validation should cover the updated csgo_gc target and basic RCON interaction paths.

Summary by CodeRabbit

  • New Features
    • Added optional local Source RCON control, including a running command server.
    • Implemented RCON commands: help, ping, status, clients, give_item, remove_item, and refresh_inventory.
    • Expanded item creation to support parameterized customization (e.g., paint, music kits, StatTrak, and stickers).
  • Bug Fixes
    • Improved RCON configuration parsing from config.txt, with warnings when RCON is enabled but no password is set.
  • Documentation
    • Updated RCON documentation, build/setup notes, README feature lists, and the example config.txt with an rcon block.
  • Chores / Build
    • Refined build configuration for thread and platform library linkage.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 03043026-86ac-4030-97b4-bef27184903b

📥 Commits

Reviewing files that changed from the base of the PR and between f18cb9a and 1650897.

📒 Files selected for processing (3)
  • csgo_gc/gc_client.cpp
  • csgo_gc/rcon_server.cpp
  • csgo_gc/rcon_server.h
🚧 Files skipped from review as they are similar to previous changes (3)
  • csgo_gc/rcon_server.h
  • csgo_gc/rcon_server.cpp
  • csgo_gc/gc_client.cpp

📝 Walkthrough

Walkthrough

Adds a Source RCON-compatible control server to csgo_gc, with ClientGC command execution, parameterized item creation, configuration support, build wiring, and documentation updates.

Changes

RCON Server and Item Control Feature

Layer / File(s) Summary
RCON configuration fields and getters
csgo_gc/config.h, csgo_gc/config.cpp, examples/config.txt
GCConfig gains RCON enablement, bind address, port, and password fields, getters, parsing from the rcon config block, and an example local RCON config.
GCEvent RconCommand event and event loop wiring
csgo_gc/gc_shared.h, csgo_gc/gc_client.h, csgo_gc/gc_client.cpp
Adds GCEvent::RconCommand, the public RunRconCommand entry point, request plumbing, and GC-thread dispatch that completes queued RCON requests.
Parameterized item creation support
csgo_gc/inventory.h, csgo_gc/inventory.cpp, csgo_gc/item_schema.h, csgo_gc/item_schema.cpp
Adds ParameterizedItemOptions, Inventory::CreateParameterizedItem, sticker attribute helpers, and ItemSchema lookups by def index for sticker kits and music definitions.
Source RCON TCP server implementation
csgo_gc/rcon_server.h, csgo_gc/rcon_server.cpp
Implements RconServer with listener lifecycle, packet framing, auth handling, connection processing, and command execution that can delegate to ClientGC.
Steam hook wiring and build/dependency setup
csgo_gc/steam_hook.cpp, CMakeLists.txt, csgo_gc/CMakeLists.txt, csgo_gc/stdafx.h
Registers the RCON server with the client GC lifecycle, starts it during hook install, and updates build and include setup for threads, sockets, and the new source file.
RCON documentation and README updates
docs/rcon.md, README.md
Adds RCON protocol and command documentation and updates README feature, installation, inventory editing, configuration, building, and credits text.

Estimated code review effort: 4 (Complex) | ~60 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Clearly summarizes the main change: adding RCON server support with accompanying inventory and config updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rcon

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@GT-610 GT-610 closed this Jul 8, 2026
@GT-610 GT-610 reopened this Jul 8, 2026
@GT-610
GT-610 changed the base branch from master to main July 8, 2026 16:41
@GT-610

GT-610 commented Jul 8, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
csgo_gc/rcon_server.cpp (1)

484-508: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

m_mutex held across the blocking RunRconCommand call.

ExecuteCommand holds m_mutex while client->RunRconCommand blocks for up to 5 seconds waiting on the GC worker. This guards m_client lifetime, but it also makes Stop() and UnregisterClient() stall for the full command/timeout duration during shutdown or client teardown. Given the accept loop is single-connection this is not a correctness bug, but consider a lifetime scheme (e.g. capturing a shared reference) that avoids holding the lock across the blocking wait.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@csgo_gc/rcon_server.cpp` around lines 484 - 508, `ExecuteCommand` currently
holds `m_mutex` while calling the blocking `ClientGC::RunRconCommand`, which can
stall `Stop()` and `UnregisterClient()` during long waits. Update
`rcon_server.cpp` so the lock is only used to safely read/protect `m_client`,
then release it before invoking `RunRconCommand`; use a lifetime-safe handle or
equivalent guard for `ClientGC` so the client remains valid without keeping
`m_mutex` locked across the wait.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@csgo_gc/config.cpp`:
- Around line 28-36: The RCON config path accepts an enabled RCON setup with an
empty password, which can lead to unauthenticated access; update the
configuration handling around config.GetSubkey("rcon") in csgo_gc::Config so it
validates m_rconEnabled together with m_rconPassword. If RCON is enabled and the
password is empty, either disable RCON, reject the config, or emit a prominent
warning and force a safe default, using the existing m_rconEnabled,
m_rconBindAddress, and m_rconPassword fields to keep the guard close to the
config load.

In `@README.md`:
- Around line 64-67: The README RCON description overstates the bind behavior by
implying it always listens on localhost when enabled. Reword the text in the
RCON section to say that localhost is the default bind only when using the
default configuration, and that the actual bind is controlled by bind_address;
keep the rest of the protocol and docs reference unchanged.

---

Nitpick comments:
In `@csgo_gc/rcon_server.cpp`:
- Around line 484-508: `ExecuteCommand` currently holds `m_mutex` while calling
the blocking `ClientGC::RunRconCommand`, which can stall `Stop()` and
`UnregisterClient()` during long waits. Update `rcon_server.cpp` so the lock is
only used to safely read/protect `m_client`, then release it before invoking
`RunRconCommand`; use a lifetime-safe handle or equivalent guard for `ClientGC`
so the client remains valid without keeping `m_mutex` locked across the wait.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0e5193cd-7ae2-4b72-a660-b26581bc2244

📥 Commits

Reviewing files that changed from the base of the PR and between af13630 and 0b3cee3.

📒 Files selected for processing (18)
  • CMakeLists.txt
  • README.md
  • csgo_gc/CMakeLists.txt
  • csgo_gc/config.cpp
  • csgo_gc/config.h
  • csgo_gc/gc_client.cpp
  • csgo_gc/gc_client.h
  • csgo_gc/gc_shared.h
  • csgo_gc/inventory.cpp
  • csgo_gc/inventory.h
  • csgo_gc/item_schema.cpp
  • csgo_gc/item_schema.h
  • csgo_gc/rcon_server.cpp
  • csgo_gc/rcon_server.h
  • csgo_gc/stdafx.h
  • csgo_gc/steam_hook.cpp
  • docs/rcon.md
  • examples/config.txt

Comment thread csgo_gc/config.cpp
Comment thread README.md
@GT-610

GT-610 commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@csgo_gc/rcon_server.cpp`:
- Around line 491-499: Make the active-client counter exception-safe in
ClientGC::RunRconCommand: the current increment happens before
client->RunRconCommand, but if that call throws the decrement and
m_clientIdle.notify_all() are skipped, leaving UnregisterClient blocked.
Refactor this block to use an RAII cleanup guard or scoped helper that always
decrements m_activeClientCommands and notifies m_clientIdle when the command
finishes or throws, while keeping the existing lock/unlock flow intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fca85982-61fa-4848-8140-bd541ab0ae7b

📥 Commits

Reviewing files that changed from the base of the PR and between 0b3cee3 and f18cb9a.

📒 Files selected for processing (4)
  • README.md
  • csgo_gc/config.cpp
  • csgo_gc/rcon_server.cpp
  • csgo_gc/rcon_server.h
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • csgo_gc/config.cpp
  • csgo_gc/rcon_server.h

Comment thread csgo_gc/rcon_server.cpp Outdated
@GT-610
GT-610 merged commit fc3ba76 into main Jul 9, 2026
3 of 4 checks passed
@GT-610
GT-610 deleted the rcon branch July 9, 2026 11:02
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