GUACAMOLE-623: Use libwebsockets' dummy callback only if defined.

This commit is contained in:
Michael Jumper 2018-09-26 21:51:07 -07:00
parent d8618b0682
commit b48a1b3a5d
2 changed files with 18 additions and 1 deletions

View File

@ -1224,6 +1224,14 @@ then
[Whether LCCSCF_USE_SSL is defined])],, [Whether LCCSCF_USE_SSL is defined])],,
[#include <libwebsockets.h>]) [#include <libwebsockets.h>])
# Older versions of libwebsockets do not define a dummy callback which
# must be invoked after the main event callback is invoked; the main event
# callback must instead manually return zero
AC_CHECK_DECL([lws_callback_http_dummy],
[AC_DEFINE([HAVE_LWS_CALLBACK_HTTP_DUMMY],,
[Whether lws_callback_http_dummy() is defined])],,
[#include <libwebsockets.h>])
fi fi
AM_CONDITIONAL([ENABLE_WEBSOCKETS], AM_CONDITIONAL([ENABLE_WEBSOCKETS],

View File

@ -66,8 +66,13 @@ static int guac_kubernetes_lws_callback(struct lws* wsi,
guac_client* client = guac_kubernetes_lws_current_client; guac_client* client = guac_kubernetes_lws_current_client;
/* Do not handle any further events if connection is closing */ /* Do not handle any further events if connection is closing */
if (client->state != GUAC_CLIENT_RUNNING) if (client->state != GUAC_CLIENT_RUNNING) {
#ifdef HAVE_LWS_CALLBACK_HTTP_DUMMY
return lws_callback_http_dummy(wsi, reason, user, in, length); return lws_callback_http_dummy(wsi, reason, user, in, length);
#else
return 0;
#endif
}
switch (reason) { switch (reason) {
@ -127,7 +132,11 @@ static int guac_kubernetes_lws_callback(struct lws* wsi,
} }
#ifdef HAVE_LWS_CALLBACK_HTTP_DUMMY
return lws_callback_http_dummy(wsi, reason, user, in, length); return lws_callback_http_dummy(wsi, reason, user, in, length);
#else
return 0;
#endif
} }