summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/messagehandler.cc4
-rw-r--r--src/munia_proto.cc16
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;