feat: Add XMPP client connection manager and consolidate build configuration - #19
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.