summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2012-05-04 14:06:29 +0200
committerJonas Suhr Christensen <jsc@umbraculum.org>2012-05-04 14:06:29 +0200
commit71f15b9dd59ee21983c00b9e74c2a1e100e02fb8 (patch)
tree8390d44d52f986445bfb15e6815ebde3235484b3 /src
parente9ac50851f3dd18c0d9cf30e1686f5cc7a193b0d (diff)
Setting correct observe id on messages.
Diffstat (limited to 'src')
-rw-r--r--src/munia_proto.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/munia_proto.cc b/src/munia_proto.cc
index 36c6e5c..d9b068f 100644
--- a/src/munia_proto.cc
+++ b/src/munia_proto.cc
@@ -203,23 +203,27 @@ int callback_lws_task(struct libwebsocket_context * context,
TaskIdList::iterator id = ids.begin();
while(id != ids.end()) {
task_t task = task_manager.task(*id);
-
+
message_t createmsg = create_msg_create(task);
+ createmsg.tid = omi->observe.id;
message_t updatemsg = create_msg_update(task);
+ updatemsg.tid = omi->observe.id;
+
msgqueue[wsi].push(createmsg);
msgqueue[wsi].push(updatemsg);
-
+
id++;
}
} else if(omi->cmd == cmd::unobserve) {
TaskIdList ids = task_manager.subTasks(omi->observe.id);
- TaskIdList::iterator id = ids.begin();
- while(id != ids.end()) {
+ TaskIdList::reverse_iterator id = ids.rbegin();
+ while(id != ids.rend()) {
task_t task = task_manager.task(*id);
message_t removemsg = create_msg_remove(task);
+ removemsg.tid = omi->observe.id;
msgqueue[wsi].push(removemsg);
id++;
@@ -236,6 +240,8 @@ int callback_lws_task(struct libwebsocket_context * context,
clientid_t clientid = (*ci).first;
taskid_t tid = (*ci).second;
+ printf("Observer id of task: %d\n", tid);
+
message_t msg = *omi;
msg.tid = tid;