SVCS - English Documentation
Loading...
Searching...
No Matches
svcs::server::Server Class Reference

Main TCP server for SVCS remote operations. More...

#include <Server.hxx>

Public Member Functions

 Server (boost::asio::io_context &io_context, unsigned short port, std::shared_ptr< RepositoryManager > repo_manager, std::shared_ptr< ISubject > event_bus)
 Constructs a Server with specified dependencies.
 ~Server ()
 Destructor - stops the server and cleans up resources.
bool start ()
 Starts the server and begins accepting connections.
void stop ()
 Stops the server gracefully.
bool isRunning () const
 Checks if the server is currently running.
unsigned short getPort () const
 Gets the port number the server is listening on.
size_t getActiveConnections () const
 Gets the number of currently active client connections.

Detailed Description

Main TCP server for SVCS remote operations.

Listens on specified port, accepts client connections, and spawns RemoteProtocol instances to handle push/pull operations. Supports multiple concurrent clients through thread pooling.

Constructor & Destructor Documentation

◆ Server()

svcs::server::Server::Server ( boost::asio::io_context & io_context,
unsigned short port,
std::shared_ptr< RepositoryManager > repo_manager,
std::shared_ptr< ISubject > event_bus )

Constructs a Server with specified dependencies.

Parameters
io_contextASIO I/O context for asynchronous operations.
portTCP port to listen on (default: 9418 - Git protocol port).
repo_managerShared pointer to repository manager.
event_busShared pointer to event bus for notifications.

Member Function Documentation

◆ getActiveConnections()

size_t svcs::server::Server::getActiveConnections ( ) const

Gets the number of currently active client connections.

Returns
size_t Number of active connections.

◆ getPort()

unsigned short svcs::server::Server::getPort ( ) const

Gets the port number the server is listening on.

Returns
unsigned short Port number.

◆ isRunning()

bool svcs::server::Server::isRunning ( ) const

Checks if the server is currently running.

Returns
bool True if server is running, false otherwise.

◆ start()

bool svcs::server::Server::start ( )

Starts the server and begins accepting connections.

Returns
bool True if server started successfully, false otherwise.

◆ stop()

void svcs::server::Server::stop ( )

Stops the server gracefully.

Stops accepting new connections and allows existing connections to complete.


The documentation for this class was generated from the following files: