aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-16 22:56:52 +0100
committerMax Kellermann <max@duempel.org>2013-01-16 22:56:52 +0100
commit1998633739b027b97ff89f92825512db91dca8f9 (patch)
treecc34205fb648273a517cc803c7ceb09f61affb1e /src
parent0194217f9d35ec2bc6e5d1ff710cf4943737d0da (diff)
downloadmpd-1998633739b027b97ff89f92825512db91dca8f9.tar.gz
mpd-1998633739b027b97ff89f92825512db91dca8f9.tar.xz
mpd-1998633739b027b97ff89f92825512db91dca8f9.zip
ClientGlobal: move client_close_all() to ClientList.cxx
Diffstat (limited to '')
-rw-r--r--src/ClientGlobal.cxx13
-rw-r--r--src/ClientList.cxx23
-rw-r--r--src/ClientList.hxx9
3 files changed, 13 insertions, 32 deletions
diff --git a/src/ClientGlobal.cxx b/src/ClientGlobal.cxx
index 47179b53d..2ce2d3839 100644
--- a/src/ClientGlobal.cxx
+++ b/src/ClientGlobal.cxx
@@ -53,20 +53,9 @@ void client_manager_init(void)
* 1024;
}
-static void client_close_all(void)
-{
- while (!client_list_is_empty()) {
- Client *client = client_list_get_first();
-
- client->Close();
- }
-
- assert(client_list_is_empty());
-}
-
void client_manager_deinit(void)
{
- client_close_all();
+ client_list_close_all();
client_max_connections = 0;
}
diff --git a/src/ClientList.cxx b/src/ClientList.cxx
index b45be34c3..bfa04fea1 100644
--- a/src/ClientList.cxx
+++ b/src/ClientList.cxx
@@ -30,25 +30,11 @@ static std::list<Client *> clients;
static unsigned num_clients;
bool
-client_list_is_empty(void)
-{
- return num_clients == 0;
-}
-
-bool
client_list_is_full(void)
{
return num_clients >= client_max_connections;
}
-Client *
-client_list_get_first(void)
-{
- assert(!clients.empty());
-
- return clients.front();
-}
-
void
client_list_add(Client *client)
{
@@ -74,3 +60,12 @@ client_list_remove(Client *client)
clients.erase(i);
--num_clients;
}
+
+void
+client_list_close_all()
+{
+ while (!clients.empty())
+ clients.front()->Close();
+
+ assert(num_clients == 0);
+}
diff --git a/src/ClientList.hxx b/src/ClientList.hxx
index fccc01d81..a5a89ceea 100644
--- a/src/ClientList.hxx
+++ b/src/ClientList.hxx
@@ -23,14 +23,8 @@
class Client;
bool
-client_list_is_empty(void);
-
-bool
client_list_is_full(void);
-Client *
-client_list_get_first(void);
-
void
client_list_add(Client *client);
@@ -40,4 +34,7 @@ client_list_foreach(void (*callback)(Client *client, void *ctx), void *ctx);
void
client_list_remove(Client *client);
+void
+client_list_close_all();
+
#endif