mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
Merge 949adfc5cf
into a656eb5f1b
This commit is contained in:
commit
a843d51422
8 changed files with 49 additions and 1 deletions
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"cmake.configureOnOpen": true
|
||||
}
|
|
@ -710,6 +710,7 @@ lws_fx_string(const lws_fx_t *a, char *buf, size_t size);
|
|||
#if defined(LWS_ROLE_MQTT)
|
||||
#include <libwebsockets/lws-mqtt.h>
|
||||
#endif
|
||||
#include <libwebsockets/lws-assert.h>
|
||||
#include <libwebsockets/lws-client.h>
|
||||
#include <libwebsockets/lws-http.h>
|
||||
#include <libwebsockets/lws-spa.h>
|
||||
|
|
21
include/libwebsockets/lws-assert.h
Normal file
21
include/libwebsockets/lws-assert.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#if !defined(__LWS_ASSERT_H__)
|
||||
#define __LWS_ASSERT_H__
|
||||
|
||||
|
||||
|
||||
|
||||
typedef void (*lws_assert_cb)(const char *file, int line, const char *expression);
|
||||
void lws_set_assert_cb(lws_assert_cb cb);
|
||||
|
||||
#ifdef LWS_ENABLE_CUSTOM_ASSERT
|
||||
void lws_assert(const char *file, int line, const char *expression);
|
||||
# ifdef assert
|
||||
# undef assert
|
||||
# endif
|
||||
#define assert(expression) (void)((expression) || (lws_assert(__FILE__, __LINE__, #expression), 0))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -32,6 +32,7 @@ if (NOT LWS_ONLY_SSPC)
|
|||
|
||||
list(APPEND SOURCES
|
||||
core/alloc.c
|
||||
core/assert.c
|
||||
core/buflist.c
|
||||
core/context.c
|
||||
core/lws_map.c
|
||||
|
|
16
lib/core/assert.c
Normal file
16
lib/core/assert.c
Normal file
|
@ -0,0 +1,16 @@
|
|||
#include "private-lib-core.h"
|
||||
|
||||
static lws_assert_cb assert_cb = NULL;
|
||||
|
||||
void lws_set_assert_cb(lws_assert_cb cb) {
|
||||
assert_cb = cb;
|
||||
}
|
||||
|
||||
void lws_assert(const char *file, int line, const char *expression) {
|
||||
if (assert_cb != NULL) {
|
||||
assert_cb(file, line, expression);
|
||||
} else {
|
||||
fprintf(stderr, "Assertion failed: %s, file %s, line %d\n", expression, file, line);
|
||||
abort();
|
||||
}
|
||||
}
|
|
@ -147,6 +147,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define LWS_ENABLE_CUSTOM_ASSERT
|
||||
#include "libwebsockets.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -286,7 +286,7 @@ hs2:
|
|||
lwsl_debug("ERROR writing to client socket\n");
|
||||
lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,
|
||||
"cws");
|
||||
return 0;
|
||||
return -1; // closed wsi so let callers know
|
||||
case LWS_SSL_CAPABLE_MORE_SERVICE:
|
||||
lws_callback_on_writable(wsi);
|
||||
break;
|
||||
|
|
5
make.sh
Executable file
5
make.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DLWS_WITH_MINIMAL_EXAMPLES=1
|
||||
make
|
Loading…
Add table
Reference in a new issue