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() ;
112 void readEvent()
override ;
113 void writeEvent()
override ;
114 void onException(
ExceptionSource * , std::exception & ,
bool )
override ;
124 static bool unlink(
G::SignalSafe ,
const char * ) noexcept ;
127 using PeerList = std::vector<std::shared_ptr<ServerPeer>> ;
132 PeerList m_peer_list ;
142 std::unique_ptr<StreamSocket> m_socket ;
150inline 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...
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket/future event...
A potential ExceptionSink that is realised by bind()ing an exception source pointer.
A tuple containing an ExceptionHandler interface pointer and a bound 'exception source' pointer.
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.
Server(ExceptionSink, const Address &listening_address, const ServerPeer::Config &, const Config &)
Constructor.
bool hasPeers() const
Returns true if peers() is not empty.
virtual std::unique_ptr< ServerPeer > newPeer(ExceptionSinkUnbound, 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.
An empty structure that is used to indicate a signal-safe, reentrant implementation.
constexpr const char * tx(const char *p)
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.