Preparation for std::enable_shared_from_this: Server- and Client-constructors are no longer public, use ::create instead
This commit is contained in:
parent
80ab651fca
commit
1992bbb4b4
8 changed files with 147 additions and 114 deletions
|
|
@ -44,6 +44,9 @@ namespace SimpleWeb {
|
|||
|
||||
template <class socket_type>
|
||||
class ServerBase {
|
||||
ServerBase(const ServerBase &) = delete;
|
||||
ServerBase &operator=(const ServerBase &) = delete;
|
||||
|
||||
public:
|
||||
virtual ~ServerBase() {}
|
||||
|
||||
|
|
@ -507,10 +510,17 @@ namespace SimpleWeb {
|
|||
|
||||
template <>
|
||||
class Server<HTTP> : public ServerBase<HTTP> {
|
||||
Server(const Server &) = delete;
|
||||
Server &operator=(const Server &) = delete;
|
||||
|
||||
public:
|
||||
Server() : ServerBase<HTTP>::ServerBase(80) {}
|
||||
static std::shared_ptr<Server> create() {
|
||||
return std::shared_ptr<Server>(new Server());
|
||||
}
|
||||
|
||||
protected:
|
||||
Server() : ServerBase<HTTP>::ServerBase(80) {}
|
||||
|
||||
void accept() override {
|
||||
//Create new socket for this connection
|
||||
//Shared_ptr is used to pass temporary objects to the asynchronous functions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue