1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
Commit graph

96 commits

Author SHA1 Message Date
TerryZhang
5eaab80708 ws: make sure we understand frame finished when buflist_out flushed
When lws_write as many bytes as user can until function returns not all sent,
the next user`s lws_write call will write wrong frame to the other end. This
will cause connection be close by the other side.
2020-03-04 12:51:47 +00:00
Jaco Kroon
0cf41c06ac build options: fix SOCKS5 and WITHOUT_CLIENT
If LWS is build with SOCKS5 support, but WITHOUT_CLIENT then a compile
failure occurs which this fixes.

Signed-off-by: Jaco Kroon <jaco@iewc.co.za>
2020-01-06 19:56:20 +00:00
Jerry Jacobs
9f9dba9f20 close.c: close reason length wrong
The string length is actually 25... solve it by measuring the same
string.
2019-12-18 14:45:31 +00:00
Andy Green
f04d18b5da server vfs: close: cleanup also at just_kill_connection
... and at transaction completion
2019-11-16 08:20:48 +00:00
Andy Green
0516966d7d http_proxy: fixes 2019-11-15 08:44:22 +00:00
Andy Green
7fad06e9e0 unix: sul schedule rename internal api and call regardless of existing timeout
Pre-sul, checking for interval to next pending scheduled event was expensive and
iterative, so the service avoided it if the wait was already 0.

With sul though, the internal "check" function also services ripe events and
removes them, and finding the interval to the next one is really cheap.

Rename the "check" function to __lws_sul_service_ripe() to make it clear it's
not just about returning the interval to the next pending one.  And call it
regardless of if we already decided we are not going to wait in the poll.

After https://github.com/warmcat/libwebsockets/pull/1745
2019-11-01 12:35:31 +00:00
Andy Green
5bd1bed6e9 sul: more paranoid casting vs libc header types 2019-10-27 15:46:58 +00:00
Andy Green
841a762992 wsproxy: clear down proxy struct at alloc 2019-10-07 16:09:24 +01:00
Zhiwen Zheng
de6a8e8194 illumos: fix build errors and warnings for v3.2-stable on illumos 2019-10-07 10:14:02 +01:00
Andy Green
3e013bf352 cgi: check for stdout failed or gone away 2019-10-05 11:15:14 +01:00
Andy Green
d9a675d213 sul: additional handling for event libs after resurrect changes 2019-09-13 06:54:56 +01:00
Andy Green
7c40fc9b12 vhost protocol timer: dont leak the object containing the sul
Converting the vhost-protocol timer to sul was correct, but we don't
clean up the object containing the sul after the timer fires, causing
a leak.
2019-09-13 06:50:39 +01:00
Sviatoslav Grebenchucov
550023ce78 sul_compare: prevent integer overflow bug 2019-08-25 19:52:11 +01:00
Andy Green
d9dd253021 Coverity fixes 2019-08-17 08:03:47 +01:00
Andy Green
1726b96d41 c++: establish a single place for opaque forward references 2019-08-17 07:20:59 +01:00
Andy Green
f00194c321 lws_dsh 2019-08-12 12:45:31 +01:00
Andy Green
d302198019 external poll: add default-off cmake option
External poll support generates a lot of messages on a busy system
for no value unless you're one of the few people using it.  It's
not recommended for new users and is there for backwards compatibility.

Make it not built by default and selectable by cmake option.
2019-08-12 12:44:36 +01:00
Andy Green
7b517eac87 lws_inform_client_conn_fail
There are many places where we have the same code to inform about client
connection failure... consolidate it
2019-08-12 12:44:36 +01:00
Andy Green
2fc35ef6bd stats: move to pt and improve presentation 2019-08-12 06:18:04 +01:00
Andy Green
498a4e2bd7 sul: all timed objects use a single pt sul list
wsi timeout, wsi hrtimer, sequencer timeout and vh-protocol timer
all now participate on a single sorted us list.

The whole idea of polling wakes is thrown out, poll waits ignore the
timeout field and always use infinite timeouts.

Introduce a public api that can schedule its own callback from the event
loop with us resolution (usually ms is all the platform can do).

Upgrade timeouts and sequencer timeouts to also be able to use us resolution.

Introduce a prepared fakewsi in the pt, so we don't have to allocate
one on the heap when we need it.

Directly handle vh-protocol timer if LWS_MAX_SMP == 1
2019-08-09 10:12:09 +01:00
Andy Green
5bbe26474a seq: LWS_WITH_SEQUENCER default-on
force off if NO_NETWORK (which is tested in travis)
2019-08-09 09:14:48 +01:00
Andy Green
3c12fd72e8 unify us sorted waits
There are quite a few linked-lists of things that want events after
some period.  This introduces a type binding an lws_dll2 for the
list and a lws_usec_t for the duration.

The wsi timeouts, the hrtimer and the sequencer timeouts are converted
to use these, also in the common event wait calculation.
2019-08-08 22:39:47 +01:00
Andy Green
45ec3ce369 lws_dll: upgrade all instances to lws_dll2
lws_dll2 removes the downsides of lws_dll and adds new features like a
running member count and explicit owner type... it's cleaner and more
robust (eg, nodes know their owner, so they can casually switch between
list owners and remove themselves without the code knowing the owner).

This deprecates lws_dll, but since it's public it allows it to continue
to be built for 4.0 release if you give cmake LWS_WITH_DEPRECATED_LWS_DLL.

All remaining internal users of lws_dll are migrated to lws_dll2.
2019-08-08 16:58:55 +01:00
Andy Green
fed78bef42 sequencer: upgrade timeout to use us
Adapt service loops and event libs to use microsecond waits
internally, for hrtimer and sequencer.  Reduce granularity
according to platform / event lib wait.

Add a helper so there's a single place to extend it.
2019-08-08 09:45:09 +01:00
Andy Green
1d954d52a3 sequencer: add second aux message arg
Since the messages are queued and then read in order from the event loop
thread, it's not generally safe to pass pointers to argument structs,
since there's no guarantee the lifetime of the thing sending the message
lasted until the sequencer read the message.

This puts pressure on the single void * argument-passed-as-value... this patch
adds a second void * argument-passed-as-value so it's more possible to put
what's needed directly in the argument.

It's also possible to alloc the argument on the heap and have the sequencer
callback free it after it has read it.
2019-08-08 09:45:09 +01:00
Andy Green
4da5b63e57 COVA10141: explicitly check there is a protocol set 2019-08-08 09:45:09 +01:00
Andy Green
ace1f432f3 COVA14522: extra check for valid protocol 2019-08-08 09:45:09 +01:00
Andy Green
71b7fd8597 sequencer: cleanup on pt takedown 2019-08-08 09:45:09 +01:00
Andy Green
f12e116188 lws_retry_bo_t: generic retry backoff
Add a generic table-based backoff scheme and a helper to track the
try count and calculate the next delay in ms.

Allow lws_sequencer_t to be given one of these at creation time...
since the number of creation args is getting a bit too much
convert that to an info struct at the same time.
2019-08-05 14:47:51 +01:00
Andy Green
5eae09540b lws_lookup: fix wsi table when unrelated_to_ulimit
The logic in the loops for insertion and deletion from the
mini, forced to non ulimit max fds in the pt mode was not
quite right.

It showed up in hard to reproduce problem with the ws client
spam test that uses the mini mode, on travis.  This should
fix the root cause.
2019-08-01 18:31:11 +01:00
Andy Green
fa8356f882 vhost: lws_get_vhost_by_name 2019-07-30 06:02:23 +01:00
Andy Green
00923627c0 client: add more descriptive string cases 2019-07-24 16:48:24 -07:00
Andy Green
b6b6915837 lws_sequencer_t: allow wsi binding 2019-07-22 14:02:00 -07:00
Andy Green
aa21fc4027 COVA10827: make lws_issue_raw safe for NULL wsi vhost 2019-07-16 10:02:37 -07:00
Andy Green
87701e5012 COVA10022: no need to set stack var 2019-07-13 13:41:42 -07:00
Andy Green
fc5defdd2a COVA10299: check lws_change_pollfd 2019-07-13 13:39:50 -07:00
Andy Green
abcaefc1ff COVA10745: lws_protocol_init can fail 2019-07-13 13:39:40 -07:00
Andy Green
4739c3234b COVA11294: check mpi_write_binary retcode 2019-07-13 13:28:54 -07:00
Andy Green
7bbf6ebc7e COVA11233: add additional deref checks 2019-07-13 13:28:54 -07:00
Andy Green
e07d6986ab COVA10081: ensure m can never be negative 2019-07-13 13:28:54 -07:00
Andy Green
1929f3a6c0 COVA11597: buffer http_proxy env var before using 2019-07-13 13:28:54 -07:00
Andy Green
fbb33af4f1 COVA11781: source indentation confused 2019-07-13 13:28:54 -07:00
Andy Green
dec1007756 COVA10141: add additional deref checks 2019-07-13 13:28:54 -07:00
Andy Green
f323205c52 COVA10063: check malloc return 2019-07-13 13:28:54 -07:00
Jackson Ming Hu
310bd7d5d4 esp32: use strerror instead of gai_strerror 2019-07-02 08:54:29 +01:00
Andy Green
e4ec282987 coverity: 2019.03 fixes 2019-07-01 06:39:55 +01:00
Andy Green
75ef709ff7 buflist: ensure all use callers have nonzero len 2019-07-01 05:53:08 +01:00
Andy Green
a7e1bac4ac unit test sequencer 2019-06-29 21:08:36 +01:00
Ico Doornekamp
604a718e92 raw-skt: server: allow tls
AG: some additional fixes and add -s tls mode to
minimal-raw-vhost
2019-06-29 21:08:36 +01:00
Andy Green
0ada40ce92 abstract: allow completely generic instantiation and destruction 2019-06-26 14:33:34 +01:00