From adab7fc5a061624ad931fee4f95de09f78ace91d Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 11 Jan 2013 15:52:08 +0100 Subject: Fix unobserve bug. Change more printf's into hugin syntax. --- src/munia_proto.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/munia_proto.cc') diff --git a/src/munia_proto.cc b/src/munia_proto.cc index 2a42884..8311f90 100644 --- a/src/munia_proto.cc +++ b/src/munia_proto.cc @@ -76,9 +76,9 @@ static void dump_handshake_info(struct lws_tokens *lwst) for (n = 0; n < WSI_TOKEN_COUNT; n++) { if (lwst[n].token == NULL || lwst[n].token_len == 0) continue; - fprintf(stderr, " %s = ", token_names[n]); + DEBUG(proto," %s = ", token_names[n]); if(fwrite(lwst[n].token, 1, lwst[n].token_len, stderr)) {} - fprintf(stderr, "\n"); + DEBUG(proto,"\n"); } } #endif @@ -166,7 +166,7 @@ int callback_lws_task(struct libwebsocket_context * context, LWS_SEND_BUFFER_PRE_PADDING, LWS_WRITE_TEXT); if(n < 0) { - fprintf(stderr, "ERROR writing to socket"); + DEBUG(proto,"ERROR writing to socket"); exit(1); } } @@ -177,7 +177,7 @@ int callback_lws_task(struct libwebsocket_context * context, case LWS_CALLBACK_BROADCAST: printf("LWS_CALLBACK_BROADCAST\n"); n = libwebsocket_write(wsi, (unsigned char*)in, len, LWS_WRITE_TEXT); - if (n < 0) fprintf(stderr, "task write failed\n"); + if (n < 0) DEBUG(proto, "task write failed\n"); break; */ @@ -231,12 +231,12 @@ int callback_lws_task(struct libwebsocket_context * context, } } else if(omi->cmd == cmd::unobserve) { - connection_handler.unobserve(wsi, omi->observe.id); + connection_handler.unobserve(wsi, omi->unobserve.id); TaskIdList ids; try { - ids = task_manager.subTasks(omi->observe.id); + ids = task_manager.subTasks(omi->unobserve.id); } catch(...) { - DEBUG(proto, "No such node %d\n", omi->observe.id); + DEBUG(proto, "No such node %d\n", omi->unobserve.id); omi++; continue; } @@ -245,8 +245,9 @@ int callback_lws_task(struct libwebsocket_context * context, task_t task = task_manager.task(*id); message_t removemsg = create_msg_remove(task); - removemsg.tid = omi->observe.id; + removemsg.tid = omi->unobserve.id; msgqueue[wsi].push_back(removemsg); + DEBUG(unobserve, "remove id: %d\n", *id); id++; } -- cgit v1.2.3