diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-06-15 14:14:57 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-06-15 14:14:57 +0200 |
commit | e1a8cfa936f6676366cbdda319a3439c00220de6 (patch) | |
tree | 1562a6e06fffe16f0cee3fc0a2164966ad68e111 /src | |
parent | cd25fd105503b035b078c3f4e37dddaab04a0c93 (diff) |
Fix observe/unobserve return message placement.
Diffstat (limited to 'src')
-rw-r--r-- | src/messagehandler.cc | 4 | ||||
-rw-r--r-- | src/munia_proto.cc | 16 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/messagehandler.cc b/src/messagehandler.cc index a394f08..361db34 100644 --- a/src/messagehandler.cc +++ b/src/messagehandler.cc @@ -140,13 +140,13 @@ MessageList handle_msg(MessageList msgList, clientid_t wsi) { case cmd::observe: { - connection_handler.observe(wsi, m.observe.id); + //connection_handler.observe(wsi, m.observe.id); outmsgs.push_back(m); } break; case cmd::unobserve: - connection_handler.unobserve(wsi, m.observe.id); + //connection_handler.unobserve(wsi, m.observe.id); outmsgs.push_back(m); break; diff --git a/src/munia_proto.cc b/src/munia_proto.cc index 61017b0..6a165db 100644 --- a/src/munia_proto.cc +++ b/src/munia_proto.cc @@ -183,7 +183,7 @@ int callback_lws_task(struct libwebsocket_context * context, case LWS_CALLBACK_RECEIVE: { - printf("LWS_CALLBACK_RECEIVE\n"); + DEBUG(proto, "LWS_CALLBACK_RECEIVE\n"); current_client = wsi; @@ -192,14 +192,15 @@ int callback_lws_task(struct libwebsocket_context * context, data.append((char*)in, len); MessageList mlst = parse_msg(data); - printf("Handling %d incoming message\n", mlst.size()); + DEBUG(proto, "Handling %d incoming message\n", mlst.size()); MessageList omsgs = handle_msg(mlst, wsi); - printf("Handling %d outgoing messages\n", omsgs.size()); + DEBUG(proto, "Handling %d outgoing messages\n", omsgs.size()); MessageList::iterator omi = omsgs.begin(); while(omi != omsgs.end()) { - + DEBUG(proto, "Message\n"); if(omi->cmd == cmd::observe) { + connection_handler.observe(wsi, omi->observe.id); TaskIdList ids; try { ids = task_manager.subTasks(omi->observe.id); @@ -224,6 +225,7 @@ int callback_lws_task(struct libwebsocket_context * context, } } else if(omi->cmd == cmd::unobserve) { + connection_handler.unobserve(wsi, omi->observe.id); TaskIdList ids; try { ids = task_manager.subTasks(omi->observe.id); @@ -244,17 +246,17 @@ int callback_lws_task(struct libwebsocket_context * context, } } else { - printf("%d nodes affected by command\n", omi->nodes.size()); + DEBUG(proto, "%d nodes affected by command\n", omi->nodes.size()); ObserverList clients = connection_handler.observerlist(omi->nodes); - printf("Writing message to %d clients\n", clients.size()); + DEBUG(proto, "Writing message to %d clients\n", clients.size()); ObserverList::iterator ci = clients.begin(); while(ci != clients.end()) { clientid_t clientid = (*ci).first; taskid_t tid = (*ci).second; - printf("Observer id of task: %d\n", tid); + DEBUG(proto, "Observer id of task: %d\n", tid); message_t msg = *omi; msg.tid = tid; |