mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
lws_smd: make api test fail immediately
This commit is contained in:
parent
a13b34db1c
commit
ad11a09a79
2 changed files with 9 additions and 5 deletions
|
@ -11,7 +11,7 @@ require_lws_config(LWS_WITH_SYS_SMD 1 requirements)
|
|||
|
||||
if (requirements)
|
||||
add_executable(${PROJECT_NAME} main.c)
|
||||
add_test(NAME api-test-lws_smd COMMAND lws-api-test-lws_smd -d1039)
|
||||
add_test(NAME api-test-lws_smd COMMAND lws-api-test-lws_smd -d1151)
|
||||
set_tests_properties(api-test-lws_smd
|
||||
PROPERTIES
|
||||
RUN_SERIAL TRUE
|
||||
|
|
|
@ -58,19 +58,23 @@ smd_cb2int(void *opaque, lws_smd_class_t _class, lws_usec_t timestamp,
|
|||
static void *
|
||||
_thread_spam(void *d)
|
||||
{
|
||||
int n;
|
||||
int n, atm = 0;
|
||||
|
||||
n = 0;
|
||||
while (n++ < 100) {
|
||||
|
||||
atm++;
|
||||
if (lws_smd_msg_printf(context, LWSSMDCL_SYSTEM_STATE,
|
||||
"{\"s\":\"state\",\"msg\":%d}",
|
||||
(unsigned int)n)) {
|
||||
lwsl_info("%s: send failed\n", __func__);
|
||||
lwsl_err("%s: send attempt %d failed\n", __func__, atm);
|
||||
n--;
|
||||
fail++;
|
||||
interrupted = 1;
|
||||
lws_cancel_service(context);
|
||||
if (fail >= 3) {
|
||||
interrupted = 1;
|
||||
lws_cancel_service(context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if defined(WIN32)
|
||||
Sleep(3);
|
||||
|
|
Loading…
Add table
Reference in a new issue