Skip to content

feat: Add XMPP client connection manager and consolidate build configuration - #19

Merged
XenoSnowFox merged 9 commits into
mainfrom
feature/client-connection-manager
Aug 29, 2026
Merged

feat: Add XMPP client connection manager and consolidate build configuration#19
XenoSnowFox merged 9 commits into
mainfrom
feature/client-connection-manager

Conversation

@XenoSnowFox

Copy link
Copy Markdown
Contributor

No description provided.

Introduce a new ClientConnectionManager for XMPP client-to-server connections. It provides a module config schema for the C2S listener port (default 5222) and registers the module for config discovery, preparing the server-side connection management scaffolding.
Refactor build configuration to use a single executable target instead of multiple intermediate libraries (xtrpg_config, xtrpg_network, xtrpg_xmpp). Sources are now compiled directly into xtrpg_cpp_server.

Changes:
- Remove separate library targets and consolidate into executable
- Add ENABLE_XMPP_JID build option
- Change include/link visibility from PUBLIC to PRIVATE
- Remove commented-out legacy storage backend code
This change introduces XML stream tokenization and a dedicated XMPP client session lifecycle. TcpConnection now supports async reads without relying on shared_from_this, and the tokenizer listener contract was simplified to a raw pointer for direct callback handling. ClientConnectionManager now tracks active sessions, creates a session for each new TCP connection, and starts processing the inbound XML stream. A new ClientSession class reads socket data, passes it through the tokenizer, and handles XML events for the XMPP client flow.
Initialize Asio io_context and start a SocketConnectionListener in main. Adds includes, a global atomic shutdown flag and signal handler (SIGINT/SIGTERM/SIGHUP) to support graceful termination. Creates a ClientConnectionManager, registers it as an observer with the listener, reads the C2S port (default 5222) from config, and runs io_context on a thread pool. On shutdown the listener is stopped, io_context is stopped and all IO threads are joined. Also adds a catch-all exception handler and informational logging.
Add std::cout debug output to ClientSession's XML handler methods (openDeclaration, closeDeclaration, setAttribute, appendText) to aid troubleshooting of XML tokenization/parsing. This is a non-functional change that only emits diagnostic logs when those hooks are invoked.
Replace the old multi-observer pattern with a single raw-pointer observer API (Observable::setObserver) and simplify dispatching. Introduce XmlToken and TokenType to represent parsed XML tokens. XmlStreamTokenizer now builds and emits XmlToken instances (and text/comments) via the Observable interface instead of calling listener methods. XmlTokenListener was converted to observer interfaces for XmlToken and TokenizationError. Update ClientSession and main to use the new setObserver/onObservation API and adjust includes. This is an API-level refactor to centralize token events and streamline tokenizer → session communication.
@XenoSnowFox
XenoSnowFox merged commit b3fcc39 into main Aug 29, 2026
4 checks passed
@XenoSnowFox
XenoSnowFox deleted the feature/client-connection-manager branch August 29, 2026 08:32
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