Permalink
Browse files

websockets: fix compatibility with older lws versions (#260)

In 1.3, 1.4 and 1.5, the function was "libwebsockets_get_protocol" not
"libwebsocket_get_protocol"  While the #define name doesn't matter on
newer libwebsockets, where it redirects to lws_get_protocol, the naming
is critical for older versions.

Fixes: 477cd3e (Fix missing context->listener for websocket client)

Signed-off-by: Karl Palsson <karlp@etactica.com>
  • Loading branch information...
karlp authored and ralight committed Sep 8, 2016
1 parent 7ba3f3d commit 03d4b8c27029da25dd350df3ca86dd7a6f1393fe
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/mosquitto_broker.h
  2. +1 −1 src/websockets.c
View
@@ -31,7 +31,7 @@ and the Eclipse Distribution License is available at
# define libwebsocket_write(A, B, C, D) lws_write((A), (B), (C), (D))
# define libwebsocket_get_socket_fd(A) lws_get_socket_fd((A))
# define libwebsockets_return_http_status(A, B, C, D) lws_return_http_status((B), (C), (D))
# define libwebsocket_get_protocol(A) lws_get_protocol((A))
# define libwebsockets_get_protocol(A) lws_get_protocol((A))
# define libwebsocket_context lws_context
# define libwebsocket_protocols lws_protocols
View
@@ -182,7 +182,7 @@ static int callback_mqtt(struct libwebsocket_context *context,
case LWS_CALLBACK_ESTABLISHED:
mosq = mqtt3_context_init(db, WEBSOCKET_CLIENT);
if(mosq){
p = libwebsocket_get_protocol(wsi);
p = libwebsockets_get_protocol(wsi);
for (i=0; i<db->config->listener_count; i++){
if (db->config->listeners[i].protocol == mp_websockets) {
for (j=0; db->config->listeners[i].ws_protocol[j].name; j++){

0 comments on commit 03d4b8c

Please sign in to comment.