summaryrefslogtreecommitdiff
path: root/src/connectionhandler.cc
diff options
context:
space:
mode:
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?");