summaryrefslogtreecommitdiff
path: root/src/task_proto.cc
diff options
context:
space:
mode:
authorJonas Suhr Christensen <jsc@umbraculum.org>2012-03-30 16:04:03 +0200
committerJonas Suhr Christensen <jsc@umbraculum.org>2012-03-30 16:04:03 +0200
commitb320cc10871217d51e3458bf85a22e7d50ee4aec (patch)
tree6afc5a990d1b719ac178e8ebd09de3e7b3114ad2 /src/task_proto.cc
parent85bc3a07c275ef60fb40bc55562b12ab2e21841d (diff)
Added a bit of debug and implemented messagehandler.
Diffstat (limited to 'src/task_proto.cc')
-rw-r--r--src/task_proto.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/task_proto.cc b/src/task_proto.cc
index 304080d..24be3b0 100644
--- a/src/task_proto.cc
+++ b/src/task_proto.cc
@@ -133,17 +133,23 @@ 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());
MessageList omsgs = handle_msg(mlst);
+ printf("Handling %d outgoing messages\n", omsgs.size());
+
MessageList::iterator omi = omsgs.begin();
while(omi != omsgs.end()) {
std::string msg;
msg.append((size_t)LWS_SEND_BUFFER_PRE_PADDING, ' ');
msg.append(msg_tostring(*omi));
msg.append((size_t)LWS_SEND_BUFFER_POST_PADDING, ' ');
-
+
+ printf("%d nodes affected by command\n", omi->nodes.size());
+
std::set<clientid_t> clients =
connection_handler.observerlist(omi->nodes);
-
+ printf("Writing message to %d clients\n", clients.size());
+
std::set<clientid_t>::iterator ci = clients.begin();
while(ci != clients.end()) {
msgqueue[*ci].push(msg);