42 class ServerPeerInfo ;
53 G_EXCEPTION( CannotBind ,
tx(
"cannot bind the listening port") )
58 bool uds_open_permissions {
false} ;
60 Config & set_uds_open_permissions(
bool b =
true ) noexcept ;
80 std::vector<std::weak_ptr<GNet::ServerPeer>>
peers() ;
114 void readEvent()
override ;
115 void writeEvent()
override ;
116 void onException(
ExceptionSource * , std::exception & ,
bool )
override ;
128 using PeerList = std::vector<std::shared_ptr<ServerPeer>> ;
133 PeerList m_peer_list ;
134 std::string m_event_logging_string ;
144 std::unique_ptr<StreamSocket> m_socket ;
152inline GNet::Server::Config & GNet::Server::Config::set_uds_open_permissions(
bool b )
noexcept { uds_open_permissions = b ;
return *this ; }
The GNet::Address class encapsulates a TCP/UDP transport address.
A class that encapsulates a network socket file descriptor and an associated windows event handle.
A base class for classes that have a file descriptor and handle asynchronous events from the event lo...
The EventStateUnbound class is used as a device to force factory methods to plumb-in an ExceptionSour...
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket/future event...
A mixin base class that identifies the source of an exception when delivered to GNet::ExceptionHandle...
An interface for a network listener.
A move-only structure used in GNet::Server::newPeer() and containing the new socket.
A network server class which listens on a specific port and spins off ServerPeer objects for each inc...
~Server() override
Destructor.
Address address() const override
Returns the listening address.
bool hasPeers() const
Returns true if peers() is not empty.
Server(EventState, const Address &listening_address, const ServerPeer::Config &, const Config &)
Constructor.
virtual std::unique_ptr< ServerPeer > newPeer(EventStateUnbound, ServerPeerInfo &&)=0
A factory method which new()s a ServerPeer-derived object.
std::vector< std::weak_ptr< GNet::ServerPeer > > peers()
Returns the list of ServerPeer objects.
void serverCleanup()
Should be called by the most-derived class's destructor in order to trigger early deletion of peer ob...
A derivation of GNet::Socket for a stream socket.
constexpr const char * tx(const char *p) noexcept
A briefer alternative to G::gettext_noop().
A configuration structure for GNet::ServerPeer.
A configuration structure for GNet::Server.
A configuration structure for GNet::StreamSocket.