1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/minimal-examples/http-client/minimal-http-client-attach
Andy Green c9731c5f17 type comparisons: fixes
This is a huge patch that should be a global NOP.

For unix type platforms it enables -Wconversion to issue warnings (-> error)
for all automatic casts that seem less than ideal but are normally concealed
by the toolchain.

This is things like passing an int to a size_t argument.  Once enabled, I
went through all args on my default build (which build most things) and
tried to make the removed default cast explicit.

With that approach it neither change nor bloat the code, since it compiles
to whatever it was doing before, just with the casts made explicit... in a
few cases I changed some length args from int to size_t but largely left
the causes alone.

From now on, new code that is relying on less than ideal casting
will complain and nudge me to improve it by warnings.
2021-01-05 10:56:38 +00:00
..
CMakeLists.txt cmake: latest cmake shows dep warnings for scripts < 2.8.12 2020-12-06 19:44:54 +00:00
minimal-http-client-attach.c type comparisons: fixes 2021-01-05 10:56:38 +00:00
README.md lws_system: helpers for attaching to existing event loop from other threads 2020-01-05 22:17:58 +00:00

lws minimal http client attach

This demonstrates how other threads can reach out to an existing lws_context and join its event loop cleanly and safely.

build

 $ cmake . && make

Pthreads is required on your system.

usage

 $ ./lws-minimal-http-client-attach
[2019/12/31 18:30:49:3495] U: main: main thread tid 0x503e1c0
[2019/12/31 18:30:50:3584] U: LWS minimal http client attach
[2019/12/31 18:30:50:4002] U: lws_create: tid 0x5c41700
[2019/12/31 18:30:50:5727] E: callback_ntpc: set up system ops for set_clock
[2019/12/31 18:30:50:2110] N: callback_ntpc: Unix time: 1577817053
[2019/12/31 18:30:50:2136] U: attach_callback: called from tid 0x5c41700
[2019/12/31 18:30:51:8733] U: Connected to 46.105.127.147, http response: 200
[2019/12/31 18:30:51:8818] U: RECEIVE_CLIENT_HTTP_READ: read 4087
[2019/12/31 18:30:51:8823] U: RECEIVE_CLIENT_HTTP_READ: read 4096
[2019/12/31 18:30:51:8846] U: RECEIVE_CLIENT_HTTP_READ: read 4087
[2019/12/31 18:30:51:8847] U: RECEIVE_CLIENT_HTTP_READ: read 4096
[2019/12/31 18:30:51:8855] U: RECEIVE_CLIENT_HTTP_READ: read 4087
[2019/12/31 18:30:51:8856] U: RECEIVE_CLIENT_HTTP_READ: read 4096
[2019/12/31 18:30:51:8860] U: RECEIVE_CLIENT_HTTP_READ: read 1971
[2019/12/31 18:30:51:8873] U: LWS_CALLBACK_COMPLETED_CLIENT_HTTP
[2019/12/31 18:30:51:9629] U: main: finished