summaryrefslogtreecommitdiff
path: root/src/connectionhandler.cc
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2012-05-04 10:46:40 +0200
committerJonas Suhr Christensen <jsc@umbraculum.org>2012-05-04 10:46:40 +0200
commit3ad0a2d6f49c6f5371e8c3b0b5c502aea58aeb75 (patch)
treee9b7e4ca4d5a786abda065deb2868fe8132aec30 /src/connectionhandler.cc
parentd0bd8f44997150bcb06137258512654c75e79b49 (diff)
parentde7c3ed2ccadcd179449dee6b8e38f6d7d2df3c6 (diff)
Merge branch 'master' of https://git.oftal.dk/munia
Diffstat (limited to 'src/connectionhandler.cc')
-rw-r--r--src/connectionhandler.cc21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/connectionhandler.cc b/src/connectionhandler.cc
index 56c465f..c8881a3 100644
--- a/src/connectionhandler.cc
+++ b/src/connectionhandler.cc
@@ -65,16 +65,13 @@ void ConnectionHandler::unobserve(clientid_t clientid, taskid_t taskid)
connlist[clientid].erase(taskid);
}
-std::list<std::pair<clientid_t, taskid_t> >
-ConnectionHandler::observerlist(TaskIdList tasks)
+ObserverList ConnectionHandler::observerlist(TaskIdList tasks)
{
printf("Observerlist request\n");
- std::list<std::pair<clientid_t, taskid_t> > clients;
+ ObserverList clients;
for(TaskIdList::iterator i = tasks.begin(); i != tasks.end(); i++) {
taskid_t tid = *i;
- // std::set<clientid_t> clientList;
- // std::map<clientid_t, taskid_t>
printf("Locating observers of node %d\n", tid);
for(ConnectionList::iterator ci = connlist.begin();
@@ -118,7 +115,7 @@ h.observe((clientid_t)3, (taskid_t)3);
{
TaskIdList tasks;
tasks.push_back((taskid_t)1);
- std::set<clientid_t> clst = h.observerlist(tasks);
+ ObserverList clst = h.observerlist(tasks);
TEST_TRUE(clst.find((clientid_t)1) != clst.end(), "Got client 1?");
TEST_TRUE(clst.find((clientid_t)2) != clst.end(), "Got client 2?");
@@ -128,7 +125,7 @@ h.observe((clientid_t)3, (taskid_t)3);
{
TaskIdList tasks;
tasks.push_back((taskid_t)3);
- std::set<clientid_t> clst = h.observerlist(tasks);
+ ObserverList clst = h.observerlist(tasks);
TEST_FALSE(clst.find((clientid_t)1) != clst.end(), "Got client 1?");
TEST_FALSE(clst.find((clientid_t)2) != clst.end(), "Got client 2?");
@@ -138,7 +135,7 @@ h.observe((clientid_t)3, (taskid_t)3);
{
TaskIdList tasks;
tasks.push_back((taskid_t)4);
- std::set<clientid_t> clst = h.observerlist(tasks);
+ ObserverList clst = h.observerlist(tasks);
TEST_FALSE(clst.find((clientid_t)1) != clst.end(), "Got client 1?");
TEST_FALSE(clst.find((clientid_t)2) != clst.end(), "Got client 2?");
@@ -150,7 +147,7 @@ h.observe((clientid_t)3, (taskid_t)3);
tasks.push_back((taskid_t)1);
tasks.push_back((taskid_t)2);
tasks.push_back((taskid_t)3);
- std::set<clientid_t> clst = h.observerlist(tasks);
+ ObserverList clst = h.observerlist(tasks);
TEST_TRUE(clst.find((clientid_t)1) != clst.end(), "Got client 1?");
TEST_TRUE(clst.find((clientid_t)2) != clst.end(), "Got client 2?");
@@ -163,7 +160,7 @@ h.close((clientid_t)1);
tasks.push_back((taskid_t)1);
tasks.push_back((taskid_t)2);
tasks.push_back((taskid_t)3);
- std::set<clientid_t> clst = h.observerlist(tasks);
+ ObserverList clst = h.observerlist(tasks);
TEST_FALSE(clst.find((clientid_t)1) != clst.end(), "Got client 1?");
TEST_TRUE(clst.find((clientid_t)2) != clst.end(), "Got client 2?");
@@ -176,7 +173,7 @@ h.close((clientid_t)2);
tasks.push_back((taskid_t)1);
tasks.push_back((taskid_t)2);
tasks.push_back((taskid_t)3);
- std::set<clientid_t> clst = h.observerlist(tasks);
+ ObserverList clst = h.observerlist(tasks);
TEST_FALSE(clst.find((clientid_t)1) != clst.end(), "Got client 1?");
TEST_FALSE(clst.find((clientid_t)2) != clst.end(), "Got client 2?");
@@ -189,7 +186,7 @@ h.close((clientid_t)3);
tasks.push_back((taskid_t)1);
tasks.push_back((taskid_t)2);
tasks.push_back((taskid_t)3);
- std::set<clientid_t> clst = h.observerlist(tasks);
+ ObserverList clst = h.observerlist(tasks);
TEST_FALSE(clst.find((clientid_t)1) != clst.end(), "Got client 1?");
TEST_FALSE(clst.find((clientid_t)2) != clst.end(), "Got client 2?");