File tree Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,6 @@ class GossipServer {
5151 // singleton instance - protected constructor
5252 GossipServer () = default ;
5353
54- explicit GossipServer (const small::server_info::ImmutableInfo& self_info)
55- : self_info(self_info) {}
56-
5754 // singleton instance - protected destructor
5855 ~GossipServer () = default ;
5956
@@ -75,6 +72,9 @@ class GossipServer {
7572 // singleton instance - get api
7673 static GossipServer* get_instance ();
7774
75+ explicit GossipServer (const small::server_info::ImmutableInfo& self_info)
76+ : self_info(self_info) {}
77+
7878 void broadcast_message (const std::string& message);
7979};
8080
Original file line number Diff line number Diff line change 7575
7676namespace small ::server {
7777
78+ class Server {
79+ private:
80+ // singleton instance - the only instance
81+ static Server* instance_ptr;
82+
83+ // singleton instance - protected destructor
84+ ~Server () = default ;
85+
86+ explicit Server (const small::server_info::ImmutableInfo& info)
87+ : info(info) {
88+ this ->gossip_server = new small::gossip::GossipServer (info);
89+ }
90+
91+ small::server_info::ImmutableInfo info;
92+
93+ small::gossip::GossipServer* gossip_server;
94+
95+ public:
96+ // singleton instance - assignment-blocker
97+ void operator =(const Server&) = delete ;
98+
99+ // singleton instance - copy-blocker
100+ Server (const Server&) = delete ;
101+
102+ // singleton instance - init api
103+ static void init_instance (const small::server_info::ImmutableInfo& info);
104+
105+ // singleton instance - get api
106+ static Server* get_instance ();
107+ };
108+
78109std::atomic<bool > stopSignal = false ;
79110
80111class ReaderWriter {
You can’t perform that action at this time.
0 commit comments