diff options
-rw-r--r-- | src/munia_proto.cc | 14 |
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; |