diff options
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/server.cpp b/src/server.cpp index 8bc1767..80ed509 100644 --- a/src/server.cpp +++ b/src/server.cpp | |||
@@ -23,15 +23,7 @@ Bu::Server::Server() : | |||
23 | 23 | ||
24 | Bu::Server::~Server() | 24 | Bu::Server::~Server() |
25 | { | 25 | { |
26 | for( SrvHash::iterator i = hServers.begin(); i != hServers.end(); i++ ) | 26 | shutdown(); |
27 | { | ||
28 | delete *i; | ||
29 | } | ||
30 | |||
31 | for( ClientHash::iterator i = hClients.begin(); i != hClients.end(); i++ ) | ||
32 | { | ||
33 | delete *i; | ||
34 | } | ||
35 | } | 27 | } |
36 | 28 | ||
37 | void Bu::Server::addPort( int nPort, int nPoolSize ) | 29 | void Bu::Server::addPort( int nPort, int nPoolSize ) |
@@ -185,3 +177,21 @@ void Bu::Server::tick() | |||
185 | } | 177 | } |
186 | } | 178 | } |
187 | 179 | ||
180 | void Bu::Server::shutdown() | ||
181 | { | ||
182 | for( SrvHash::iterator i = hServers.begin(); i != hServers.end(); i++ ) | ||
183 | { | ||
184 | delete *i; | ||
185 | } | ||
186 | |||
187 | hServers.clear(); | ||
188 | |||
189 | for( ClientHash::iterator i = hClients.begin(); i != hClients.end(); i++ ) | ||
190 | { | ||
191 | onClosedConnection( *i ); | ||
192 | delete *i; | ||
193 | } | ||
194 | |||
195 | hClients.clear(); | ||
196 | } | ||
197 | |||