/*
* libwebsockets - small server side websockets and web server implementation
*
- * Copyright (C) 2010-2013 Andy Green <andy@warmcat.com>
+ * Copyright (C) 2010-2014 Andy Green <andy@warmcat.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
}
}
#endif
- if (eff_buf.token_len <= 0 && callback_action != LWS_CALLBACK_CLIENT_RECEIVE_PONG)
+ if (eff_buf.token_len <= 0 &&
+ callback_action != LWS_CALLBACK_CLIENT_RECEIVE_PONG)
goto already_done;
eff_buf.token[eff_buf.token_len] = '\0';
if (callback_action == LWS_CALLBACK_CLIENT_RECEIVE_PONG)
lwsl_info("Client doing pong callback\n");
- wsi->protocol->callback(
+ m = wsi->protocol->callback(
wsi->protocol->owning_server,
wsi,
(enum libwebsocket_callback_reasons)callback_action,
eff_buf.token,
eff_buf.token_len);
+ /* if user code wants to close, let caller know */
+ if (m)
+ return 1;
+
already_done:
wsi->u.ws.rx_user_buffer_head = 0;
break;
* we will get a destroy callback to take care
* of closing nicely
*/
- lwsl_err("zlib error inflate %d: %s\n",
+ lwsl_info("zlib error inflate %d: %s\n",
n, conn->zs_in.msg);
return -1;
}
case LWS_CONNMODE_WS_CLIENT:
for (n = 0; n < len; n++)
if (libwebsocket_client_rx_sm(wsi, *buf++)) {
- lwsl_info("client_rx_sm failed\n");
+ lwsl_debug("client_rx_sm failed\n");
goto bail;
}
return 0;
for (n = 0; n < len; n++)
if (libwebsocket_client_rx_sm(
wsi, *buf++) < 0) {
- lwsl_info("client rx has bailed\n");
+ lwsl_debug("client rx has bailed\n");
goto bail;
}
#endif
bail:
- lwsl_info("closing connection at libwebsocket_read bail:\n");
+ lwsl_debug("closing connection at libwebsocket_read bail:\n");
libwebsocket_close_and_free_session(context, wsi,
LWS_CLOSE_STATUS_NOSTATUS);