1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

seq: LWS_WITH_SEQUENCER default-on

force off if NO_NETWORK (which is tested in travis)
This commit is contained in:
Andy Green 2019-08-09 09:14:48 +01:00
parent 3c12fd72e8
commit 5bbe26474a
7 changed files with 25 additions and 6 deletions

View file

@ -130,6 +130,7 @@ option(LWS_WITH_ZLIB "Include zlib support (required for extensions)" OFF)
option(LWS_WITH_BUNDLED_ZLIB "Use bundled zlib version (Windows only)" ${LWS_WITH_BUNDLED_ZLIB_DEFAULT})
option(LWS_WITH_MINIZ "Use miniz instead of zlib" OFF)
option(LWS_WITH_DEPRECATED_LWS_DLL "Migrate to lws_dll2 instead ASAP" OFF)
option(LWS_WITH_SEQUENCER "lws_seq_t support" ON)
#
# to use miniz, enable both LWS_WITH_ZLIB and LWS_WITH_MINIZ
#
@ -217,6 +218,7 @@ if (NOT LWS_WITH_NETWORK)
set(LWS_WITH_HTTP_STREAM_COMPRESSION 0)
set(LWS_WITH_HTTP_BROTLI 0)
set(LWS_WITH_POLL 0)
set(LWS_WITH_SEQUENCER 0)
endif()
if (LWS_WITH_STRUCT_SQLITE3)
@ -957,7 +959,6 @@ if (LWS_WITH_NETWORK)
lib/core-net/network.c
lib/core-net/vhost.c
lib/core-net/pollfd.c
lib/core-net/sequencer.c
lib/core-net/service.c
lib/core-net/sorted-usec-list.c
lib/core-net/stats.c
@ -966,13 +967,22 @@ if (LWS_WITH_NETWORK)
lib/core-net/adopt.c
lib/roles/pipe/ops-pipe.c
)
if (LWS_WITH_SEQUENCER)
list(APPEND SOURCES
lib/core-net/sequencer.c)
endif()
if (LWS_WITH_ABSTRACT)
list(APPEND SOURCES
lib/abstract/abstract.c
lib/abstract/test-sequencer.c
)
if (LWS_WITH_SEQUENCER)
list(APPEND SOURCES
lib/abstract/test-sequencer.c)
endif()
endif()
if (LWS_WITH_STATS)
list(APPEND SOURCES
lib/core-net/stats.c

View file

@ -126,6 +126,7 @@
#cmakedefine LWS_WITH_POLL
#cmakedefine LWS_WITH_RANGES
#cmakedefine LWS_WITH_SELFTESTS
#cmakedefine LWS_WITH_SEQUENCER
#cmakedefine LWS_WITH_SERVER_STATUS
#cmakedefine LWS_WITH_SMTP
#cmakedefine LWS_WITH_SOCKS5

View file

@ -557,9 +557,10 @@ lws_service_periodic_checks(struct lws_context *context,
if (context->time_up < 1464083026 && now > 1464083026)
context->time_up = now;
#if defined(LWS_WITH_SEQUENCER)
__lws_seq_timeout_check(pt, usnow);
lws_pt_do_pending_sequencer_events(pt);
#endif
if (context->last_timeout_check_s == now)
return 0;

View file

@ -551,8 +551,10 @@ lws_context_destroy3(struct lws_context *context)
for (n = 0; n < context->count_threads; n++) {
struct lws_context_per_thread *pt = &context->pt[n];
(void)pt;
#if defined(LWS_WITH_SEQUENCER)
lws_seq_destroy_all_on_pt(pt);
#endif
if (context->event_loop_ops->destroy_pt)
context->event_loop_ops->destroy_pt(context, n);

View file

@ -1,7 +1,7 @@
/*
* libwebsockets - small server side websockets and web server implementation
*
* Copyright (C) 2010-2018 Andy Green <andy@warmcat.com>
* Copyright (C) 2010-2019 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
@ -38,11 +38,13 @@ __lws_event_service_get_earliest_wake(struct lws_context_per_thread *pt,
us = t;
seen = 1;
}
#if defined(LWS_WITH_SEQUENCER)
t = __lws_seq_timeout_check(pt, usnow);
if (t && (!seen || t < us)) {
us = t;
seen = 1;
}
#endif
return us;
}

View file

@ -138,12 +138,14 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
lws_pt_unlock(pt);
#if defined(LWS_WITH_SEQUENCER)
/*
* if there are any pending sequencer events, handle the next one
* for all sequencers with pending events. If nothing to do returns
* immediately.
*/
lws_pt_do_pending_sequencer_events(pt);
#endif
m = 0;
#if defined(LWS_ROLE_WS) && !defined(LWS_WITHOUT_EXTENSIONS)

View file

@ -64,6 +64,7 @@ ENDMACRO()
set(requirements 1)
require_lws_config(LWS_ROLE_H1 1 requirements)
require_lws_config(LWS_WITHOUT_CLIENT 0 requirements)
require_lws_config(LWS_WITH_SEQUENCER 1 requirements)
if (requirements)
add_executable(${SAMP} ${SRCS})