[Libwebsockets] minimal-ws-client with foreign libevent loop

Andy Green andy at warmcat.com
Tue Feb 9 22:33:02 CET 2021



On 2/9/21 9:22 PM, John Dunn wrote:
> On Tuesday, February 9, 2021 12:25 PM, Andy Green wrote:
>> If you create the libevent loop first - which is not something you come back from - and move the lws
>> context creation to happen at the libevent timer callback inside the libevent context, everything will start
>> working without any further changes.
> 
> Thank you for the suggestion. I removed any libwebsocket initialization code from main and changed my timer function to code below and still get the same output on the console and saw no changes in behavior - connect_callback is never called. The 1us was used in the original sample code to 'connect immediately' but I changed that to 1 second just to make sure that wasn't the issue.
> 
> I'm looking at the code in libevent.c ( part of libwebsocket ) and it's not entirely clear to me how it is supposed to work. I'm guessing that lws_sul_schedule is going be driven off a libevent timer but the only places I see evtimer_add being called is either within a timer callback or in lws_event_cb which I think is the event related to the connection socket. None of those code paths are being called and to be honest I don't see how they possibly could - I need a timer to schedule the connection but the timer isn't created before the connection had been created.

Well, I appreciate your taking the time to explain to me that there's no 
way lws can work.

Why don't you try the below version of your app changed to do what I 
suggested in my reply and tested on Fedora before I originally replied...

gcc /tmp/t.c -lwebsockets -levent && ./a.out

/*
* lws-minimal-ws-client
*
* Written in 2010-2020 by Andy Green <andy at warmcat.com>
*
* This file is made available under the Creative Commons CC0 1.0
* Universal Public Domain Dedication.
*
* This demonstrates a ws client that connects by default to 
libwebsockets.org
* dumb increment ws server.
*/

#include <libwebsockets.h>
#include <string.h>
#include <signal.h>
#include <event2/event.h>
/*
* This represents your object that "contains" the client connection and has
* the client connection bound to it
*/

static struct my_conn {
   lws_sorted_usec_list_t	sul;	     /* schedule connection retry */
   struct lws		*wsi;	     /* related wsi if any */
   uint16_t		retry_count; /* count of consequetive retries */
} mco;

static struct lws_context *context;
static int interrupted, port = 443, ssl_connection = LCCSCF_USE_SSL;
static const char *server_address = "libwebsockets.org",
*pro = "dumb-increment-protocol";
   struct lws_context_creation_info info;


static struct event_base* loop_event;
static struct event* timer_event;
static struct event *sighandler_event;


/*
* The retry and backoff policy we want to use for our client connections
*/

static const uint32_t backoff_ms[] = { 1000, 2000, 3000, 4000, 5000 };

static const lws_retry_bo_t retry = {
   .retry_ms_table = backoff_ms,
   .retry_ms_table_count = LWS_ARRAY_SIZE(backoff_ms),
   .conceal_count = LWS_ARRAY_SIZE(backoff_ms),

   .secs_since_valid_ping = 3,  /* force PINGs after secs idle */
   .secs_since_valid_hangup = 10, /* hangup after secs idle */

   .jitter_percent = 20,
};

/*
* Scheduled sul callback that starts the connection attempt
*/

static void
connect_client(lws_sorted_usec_list_t *sul)
{
   printf("---> connect_client\n");

   struct my_conn *mco = lws_container_of(sul, struct my_conn, sul);
   struct lws_client_connect_info i;

   memset(&i, 0, sizeof(i));

   i.context = context;
   i.port = port;
   i.address = server_address;
   i.path = "/";
   i.host = i.address;
   i.origin = i.address;
   i.ssl_connection = ssl_connection;
   i.protocol = pro;
   i.local_protocol_name = "lws-minimal-client";
   i.pwsi = &mco->wsi;
   i.retry_and_idle_policy = &retry;
   i.userdata = mco;

   if (!lws_client_connect_via_info(&i))
     /*
     * Failed... schedule a retry... we can't use the _retry_wsi()
     * convenience wrapper api here because no valid wsi at this
     * point.
     */
     if (lws_retry_sul_schedule(context, 0, sul, &retry,
       connect_client, &mco->retry_count)) {
       lwsl_err("%s: connection attempts exhausted\n", __func__);
       interrupted = 1;
     }
}

static int
callback_minimal(struct lws *wsi, enum lws_callback_reasons reason,
   void *user, void *in, size_t len)
{
   printf("---> callback_minimal\n");
   struct my_conn *mco = (struct my_conn *)user;

   switch (reason) {

   case LWS_CALLBACK_CLIENT_CONNECTION_ERROR:
     lwsl_err("CLIENT_CONNECTION_ERROR: %s\n",
       in ? (char *)in : "(null)");
     goto do_retry;
     break;

   case LWS_CALLBACK_CLIENT_RECEIVE:
     lwsl_hexdump_notice(in, len);
     break;

   case LWS_CALLBACK_CLIENT_ESTABLISHED:
     lwsl_user("%s: established\n", __func__);
     break;

   case LWS_CALLBACK_CLIENT_CLOSED:
     goto do_retry;

   default:
     break;
   }

   return lws_callback_http_dummy(wsi, reason, user, in, len);

do_retry:
   /*
   * retry the connection to keep it nailed up
   *
   * For this example, we try to conceal any problem for one set of
   * backoff retries and then exit the app.
   *
   * If you set retry.conceal_count to be larger than the number of
   * elements in the backoff table, it will never give up and keep
   * retrying at the last backoff delay plus the random jitter amount.
   */
   if (lws_retry_sul_schedule_retry_wsi(wsi, &mco->sul, connect_client,
     &mco->retry_count)) {
     lwsl_err("%s: connection attempts exhausted\n", __func__);
     interrupted = 1;
   }

   return 0;
}

static const struct lws_protocols protocols[] = {
   { "lws-minimal-client", callback_minimal, 0, 0, },
   { NULL, NULL, 0, 0 }
};

static void
sigint_handler(int fd, short event, void *arg)
{
   int signum = (int)(lws_intptr_t)arg;
   lwsl_notice("Signal %d caught, exiting...\n", signum);
   switch (signum) {
   case SIGTERM:
   case SIGINT:
     break;
   default:
     break;
   }
   lws_context_destroy(context);
}

static int count = 0;

static void
timer_cb_event(int fd, short event, void *arg)
{
   printf("---> this is a timer %i!\n", count);
   if (count == 0)
   {
     printf("---> scheduling timer!\n");
   int n = 0;

   //signal(SIGINT, sigint_handler);
   lwsl_user("LWS minimal ws client\n");
   int logs = LLL_USER | LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_INFO | 
LLL_CLIENT;
   lws_set_log_level(logs, NULL);

   info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT | 
LWS_SERVER_OPTION_LIBEVENT;
   info.port = CONTEXT_PORT_NO_LISTEN; /* we do not run any server */
   info.protocols = protocols;
   void *foreign_loops[1];
   foreign_loops[0] = loop_event;
   info.foreign_loops = foreign_loops;


#if defined(LWS_WITH_MBEDTLS) || defined(USE_WOLFSSL)
   /*
   * OpenSSL uses the system trust store.  mbedTLS has to be told which
   * CA to trust explicitly.
   */
   info.client_ssl_ca_filepath = "./libwebsockets.org.cer";
#endif

  info.fd_limit_per_thread = 1 + 1 + 1;

   context = lws_create_context(&info);
   if (!context) {
     lwsl_err("lws init failed\n");
     return 1;
   }


     lws_sul_schedule(context, 0, &mco.sul, connect_client, LWS_US_PER_SEC);
   }
   count = count + 1;
   //foreign_timer_service(loop_event);
}

int main(int argc, const char **argv)
{
   //WSADATA wsa_data;
   //WSAStartup(0x0201, &wsa_data);

   struct timeval tv = {.tv_sec = 1, .tv_usec = 0};
    const char *p;
  loop_event = event_base_new();
   sighandler_event = evsignal_new(loop_event, SIGINT, sigint_handler, 
(void*)SIGINT);
   timer_event = event_new(loop_event, -1, EV_PERSIST, timer_cb_event, 
NULL);
   evtimer_add(timer_event, &tv);

   if ((p = lws_cmdline_option(argc, argv, "--protocol")))
     pro = p;

   if ((p = lws_cmdline_option(argc, argv, "-s")))
     server_address = p;

   if ((p = lws_cmdline_option(argc, argv, "-p")))
     port = atoi(p);

   if (lws_cmdline_option(argc, argv, "-n"))
     ssl_connection &= ~LCCSCF_USE_SSL;

   if (lws_cmdline_option(argc, argv, "-j"))
     ssl_connection |= LCCSCF_ALLOW_SELFSIGNED;

   if (lws_cmdline_option(argc, argv, "-k"))
     ssl_connection |= LCCSCF_ALLOW_INSECURE;

   if (lws_cmdline_option(argc, argv, "-m"))
     ssl_connection |= LCCSCF_SKIP_SERVER_CERT_HOSTNAME_CHECK;

   if (lws_cmdline_option(argc, argv, "-e"))
     ssl_connection |= LCCSCF_ALLOW_EXPIRED;
   memset(&info, 0, sizeof info);
   lws_cmdline_option_handle_builtin(argc, argv, &info);


    /* schedule the first client connection attempt to happen immediately */
   //lws_sul_schedule(context, 0, &mco.sul, connect_client, 1);

   event_base_loop(loop_event, 0);


//  while (n >= 0 && !interrupted)
//    n = lws_service(context, 0);

   lws_context_destroy(context);
   lwsl_user("Completed\n");

   return 0;
}

---> this is a timer 0!
---> scheduling timer!
[2021/02/09 19:20:59:4423] U: LWS minimal ws client
[2021/02/09 19:20:59:4425] N: LWS: 4.1.99-v4.1.0-271-gf36a831deb, 
loglevel 1295
[2021/02/09 19:20:59:4425] N: NET CLI SRV H1 H2 WS SS-JSON-POL SSPROX 
ASYNC_DNS IPV6-on
[2021/02/09 19:20:59:4425] I: lws_create_context: ev lib path 
/usr/local/lib, '(null)'
[2021/02/09 19:20:59:4425] I: lws_plugins_init: trying .
[2021/02/09 19:20:59:4427] I: lws_plugins_init: trying /usr/local/lib
[2021/02/09 19:20:59:4429] I:    trying 
/usr/local/lib/libwebsockets-evlib_event.so
[2021/02/09 19:20:59:4432] N:    /usr/local/lib/libwebsockets-evlib_event.so
[2021/02/09 19:20:59:4432] I: Event loop: libevent
[2021/02/09 19:20:59:4433] I:  ctx:  7032B (2936 ctx + pt(1 thr x 
4096)), pt-fds: 6, fdmap: 48
[2021/02/09 19:20:59:4434] I:  http: ah_data: 4096, ah: 984, max count 6
[2021/02/09 19:20:59:4434] I:  mem: platform fd map:    48 B
[2021/02/09 19:20:59:4434] I: elops_init_pt_event: loop 0x2194900
[2021/02/09 19:20:59:4434] N:  ++ [496664|wsi|0|pipe] (1)
[2021/02/09 19:20:59:4435] I: rops_pt_init_destroy_netlink: creating 
netlink skt
[2021/02/09 19:20:59:4436] N:  ++ [496664|vh|0|netlink] (1)
[2021/02/09 19:20:59:4437] I:  Compiled with OpenSSL support
[2021/02/09 19:20:59:4437] I: Doing SSL library init
[2021/02/09 19:20:59:4478] I:  canonical_hostname = constancewu
[2021/02/09 19:20:59:4478] N:  ++ [496664|vh|1|system] (2)
[2021/02/09 19:20:59:4478] I: Creating Vhost 'system' (serving 
disabled), 6 protocols, IPv6 on
[2021/02/09 19:20:59:4479] I: lws_create_adopt_udp: 192.168.4.1:53
[2021/02/09 19:20:59:4479] N:  ++ [496664|wsisrv|0|adopted] (1)
[2021/02/09 19:20:59:4479] I: lws_async_dns_query: entry 192.168.4.1
[2021/02/09 19:20:59:4479] I: lws_adns_dump: ADNS cache 0 entries
[2021/02/09 19:20:59:4479] I: lws_async_dns_query: 192.168.4.1 uncached
[2021/02/09 19:20:59:4479] I: lws_adns_dump: ADNS cache 1 entries
[2021/02/09 19:20:59:4479] I: lws_adns_dump: cache: '192.168.4.1', exp: 
3599999998us, incomp 0, fl 0x0, refc 0, res 0x21bee08
[2021/02/09 19:20:59:4479] I: lws_sort_dns: sort_dns: 0x21bee08
[2021/02/09 19:20:59:4479] I: lws_sort_dns: unsorted entry (af 2) 
192.168.4.1
[2021/02/09 19:20:59:4479] I: lws_sort_dns_dump: 1: (2)192.168.4.1, gw 
(0)(bad AF 0), idi: 0, lbl: 0, prec: 0
[2021/02/09 19:20:59:4479] I: lws_adopt_descriptor_vhost2: 
[496664|wsisrv|0|adopted|raw-skt], vhost [496664|vh|1|system]
[2021/02/09 19:20:59:4479] N:  ++ [496664|vh|2|default] (3)
[2021/02/09 19:20:59:4479] I: Creating Vhost 'default' (serving 
disabled), 5 protocols, IPv6 on
[2021/02/09 19:20:59:4481] I: lws_tls_client_create_vhost_context: vh 
default: created new client ctx 0
[2021/02/09 19:20:59:4527] I: created client ssl context for default
---> callback_minimal
[2021/02/09 19:20:59:4527] I:  mem: per-conn:         1168 bytes + 
protocol rx buf
[2021/02/09 19:20:59:4527] I: lws_plat_drop_app_privileges: not changing 
group
[2021/02/09 19:20:59:4527] I: lws_plat_drop_app_privileges: not changing 
user
[2021/02/09 19:20:59:4527] I:  dst: (0)(bad AF 0)/0, src: (0)(bad AF 
0)/0, gw: (2)192.168.4.1, ifidx: 18, pri: 100, proto: 16
[2021/02/09 19:20:59:4528] I:  dst: (2)192.168.4.0/24, src: 
(2)192.168.4.72/0, gw: (0)(bad AF 0), ifidx: 18, pri: 100, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (2)192.168.122.0/24, src: 
(2)192.168.122.1/0, gw: (0)(bad AF 0), ifidx: 4, pri: -1, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (2)127.0.0.0/8, src: (2)127.0.0.1/0, 
gw: (0)(bad AF 0), ifidx: 1, pri: -1, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (2)127.0.0.1/32, src: 
(2)127.0.0.1/0, gw: (0)(bad AF 0), ifidx: 1, pri: -1, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (2)192.168.4.72/32, src: 
(2)192.168.4.72/0, gw: (0)(bad AF 0), ifidx: 18, pri: -1, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (2)192.168.122.1/32, src: 
(2)192.168.122.1/0, gw: (0)(bad AF 0), ifidx: 4, pri: -1, proto: 2
---> callback_minimal
[2021/02/09 19:20:59:4528] I:  dst: (0)(bad AF 0)/0, src: (0)(bad AF 
0)/0, gw: (2)192.168.4.1, ifidx: 18, pri: 100, proto: 16
[2021/02/09 19:20:59:4528] I:  dst: (2)192.168.4.0/24, src: 
(2)192.168.4.72/0, gw: (0)(bad AF 0), ifidx: 18, pri: 100, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (2)192.168.122.0/24, src: 
(2)192.168.122.1/0, gw: (0)(bad AF 0), ifidx: 4, pri: -1, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (2)127.0.0.0/8, src: (2)127.0.0.1/0, 
gw: (0)(bad AF 0), ifidx: 1, pri: -1, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (2)127.0.0.1/32, src: 
(2)127.0.0.1/0, gw: (0)(bad AF 0), ifidx: 1, pri: -1, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (2)192.168.4.72/32, src: 
(2)192.168.4.72/0, gw: (0)(bad AF 0), ifidx: 18, pri: -1, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (2)192.168.122.1/32, src: 
(2)192.168.122.1/0, gw: (0)(bad AF 0), ifidx: 4, pri: -1, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (10)::1/128, src: (0)(bad AF 0)/0, 
gw: (0)(bad AF 0), ifidx: 1, pri: 256, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (10)fe80::/64, src: (0)(bad AF 0)/0, 
gw: (0)(bad AF 0), ifidx: 18, pri: 100, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (10)::1/128, src: (0)(bad AF 0)/0, 
gw: (0)(bad AF 0), ifidx: 1, pri: 0, proto: 2
[2021/02/09 19:20:59:4528] I:  dst: (10)fe80::e601:5a5:1493:3d49/128, 
src: (0)(bad AF 0)/0, gw: (0)(bad AF 0), ifidx: 18, pri: 0, proto: 2
---> callback_minimal
[2021/02/09 19:20:59:4539] I: lws_protocol_init
---> callback_minimal
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: destroy msg 
0x21eb990
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: destroy msg 
0x21e5190
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: destroy msg 
0x21e5670
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: destroy msg 
0x21e3bc0
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: destroy msg 
0x21c71a0
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: destroy msg 
0x21c4460
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: destroy msg 
0x2280650
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 42, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4539] I: lws_ss_create: unknown stream type 
captive_portal_detect
[2021/02/09 19:20:59:4539] I: lws_ss_sys_cpd: Create stream failed (policy?)
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: destroy msg 
0x21bffa0
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: destroy msg 
0x227dfa0
[2021/02/09 19:20:59:4539] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4540] I: _lws_smd_msg_deliver_peer: destroy msg 
0x225bcb0
[2021/02/09 19:20:59:4540] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4540] I: _lws_smd_msg_deliver_peer: destroy msg 
0x2262860
[2021/02/09 19:20:59:4540] I: _lws_smd_msg_deliver_peer: deliver cl 0x4, 
len 13, refc 1, to peer 0x2195140
[2021/02/09 19:20:59:4540] I: _lws_smd_msg_deliver_peer: destroy msg 
0x2263fb0
[2021/02/09 19:20:59:4540] I: lws_state_notify_protocol_init: waiting 
for netlink coldplug
[2021/02/09 19:20:59:4540] I: _report: system: prot_init: rejected 
'INITIALIZED' -> 'IFACE_COLDPLUG'
[2021/02/09 19:20:59:4540] I: lws_state_transition_steps: 
CONTEXT_CREATED -> INITIALIZED
[2021/02/09 19:20:59:5532] I: lws_state_transition_steps: INITIALIZED -> 
OPERATIONAL
---> this is a timer 1!
---> connect_client
[2021/02/09 19:21:00:4536] I: lws_client_connect_via_info: role binding 
to h1
[2021/02/09 19:21:00:4536] I: lws_client_connect_via_info: vh default 
protocol binding to lws-minimal-client
---> callback_minimal
[2021/02/09 19:21:00:4537] I: lws_client_connect_via_info: : h1 
lws-minimal-client entry
[2021/02/09 19:21:00:4537] N:  ++ 
[496664|wsicli|0|WS/h1/libwebsockets.org] (1)
[2021/02/09 19:21:00:4537] I: lws_header_table_attach: 
[496664|wsicli|0|WS/h1/libwebsockets.org|default]: ah (nil) (tsi 0, 
count = 0) in
[2021/02/09 19:21:00:4537] I: _lws_create_ah: created ah 0x2282dc0 (size 
4096): pool length 1
[2021/02/09 19:21:00:4537] I: lws_header_table_attach: did attach wsi 
[496664|wsicli|0|WS/h1/libwebsockets.org|default]: ah 0x2282dc0: count 1 
(on exit)
[2021/02/09 19:21:00:4538] I: lws_client_connect_2_dnsreq: 
[496664|wsicli|0|WS/h1/libwebsockets.org|default]: lookup 
libwebsockets.org:443
[2021/02/09 19:21:00:4538] I: lws_async_dns_query: entry libwebsockets.org
[2021/02/09 19:21:00:4538] I: lws_adns_dump: ADNS cache 1 entries
[2021/02/09 19:21:00:4538] I: lws_adns_dump: cache: '192.168.4.1', exp: 
3598994074us, incomp 0, fl 0x0, refc 0, res 0x21bee08
[2021/02/09 19:21:00:4538] I: lws_async_dns_query: libwebsockets.org 
uncached
[2021/02/09 19:21:00:4539] I: lws_async_dns_query: created new query:
[2021/02/09 19:21:00:4539] I: lws_adns_dump: ADNS cache 1 entries
[2021/02/09 19:21:00:4539] I: lws_adns_dump: cache: '192.168.4.1', exp: 
3598993941us, incomp 0, fl 0x0, refc 0, res 0x21bee08
[2021/02/09 19:21:00:4539] I: lws_adns_dump: q: 'libwebsockets.org', 
sent 0, resp 0
---> callback_minimal
[2021/02/09 19:21:00:4540] I: lws_async_dns_writeable: 
libwebsockets.org, which 1
[2021/02/09 19:21:00:4541] I: lws_issue_raw: ssl_capable_write (35) says 35
[2021/02/09 19:21:00:4542] I: lws_async_dns_writeable: 
libwebsockets.org, which 0
[2021/02/09 19:21:00:4542] I: lws_issue_raw: ssl_capable_write (35) says 35
[2021/02/09 19:21:00:4552] I: lws_adns_parse_udp: create cache entry for 
libwebsockets.org, 94
[2021/02/09 19:21:00:4553] I: lws_async_dns_store: 0: libwebsockets.org: 
2001:41d0:2:ee93::1
[2021/02/09 19:21:00:4554] I: lws_adns_parse_udp: create cache entry for 
libwebsockets.org, 82
[2021/02/09 19:21:00:4555] I: lws_async_dns_store: 0: libwebsockets.org: 
46.105.127.147
[2021/02/09 19:21:00:4555] I: lws_sort_dns: sort_dns: 0x2284398
[2021/02/09 19:21:00:4555] I: lws_sort_dns: unsorted entry (af 10) 
2001:41d0:2:ee93::1
[2021/02/09 19:21:00:4555] I: _lws_route_est_outgoing: returning (nil)
[2021/02/09 19:21:00:4555] I: lws_sort_dns: 2001:41d0:2:ee93::1 has no 
route out
[2021/02/09 19:21:00:4556] I: lws_sort_dns: unsorted entry (af 2) 
46.105.127.147
[2021/02/09 19:21:00:4556] I: _lws_route_est_outgoing: gw hit
[2021/02/09 19:21:00:4556] I: _lws_route_est_outgoing: returning 0x2280a40
[2021/02/09 19:21:00:4556] I: lws_sort_dns_dump: 1: (2)46.105.127.147, 
gw (0)(bad AF 0), idi: 18, lbl: 0, prec: 0
[2021/02/09 19:21:00:4556] I: lws_client_connect_3_connect: 
peer_route_uidx 1
[2021/02/09 19:21:00:4558] I: lws_adns_dump: ADNS cache 2 entries
[2021/02/09 19:21:00:4558] I: lws_adns_dump: cache: 'libwebsockets.org', 
exp: 368038597771us, incomp 1, fl 0x2, refc 0, res 0x2284398
[2021/02/09 19:21:00:4558] I: lws_adns_dump: cache: '192.168.4.1', exp: 
3598992051us, incomp 0, fl 0x0, refc 0, res 0x21bee08
[2021/02/09 19:21:00:4558] I: lws_adns_dump: q: 'libwebsockets.org', 
sent 1, resp 3
[2021/02/09 19:21:00:4821] I: lws_client_connect_3_connect: 
[496664|wsicli|0|WS/h1/libwebsockets.org|default]: source ads 192.168.4.72
---> callback_minimal
[2021/02/09 19:21:00:4821] I: lws_client_connect_4_established: 
[496664|wsicli|0|WS/h1/libwebsockets.org|default]: h1 lws-minimal-client 
client created own conn (raw 0) vh defaultm st 0x202
[2021/02/09 19:21:00:4822] I: h1 client conn using alpn list 'http/1.1'
[2021/02/09 19:21:00:5348] I: lws_role_call_alpn_negotiated: 'http/1.1'
[2021/02/09 19:21:00:5348] I: client connect OK
[2021/02/09 19:21:00:5348] I: lws_openssl_describe_cipher: 
[496664|wsicli|0|WS/h1/libwebsockets.org|default|h1]: 
TLS_AES_256_GCM_SHA384, TLS_AES_256_GCM_SHA384, 256 bits, TLSv1.3
---> callback_minimal
[2021/02/09 19:21:00:5348] I: lws_http_client_socket_service: 
HANDSHAKE2: [496664|wsicli|0|WS/h1/libwebsockets.org|default|h1]: 
sending headers (wsistate 0x10000204), w sock 10
---> callback_minimal
---> callback_minimal
[2021/02/09 19:21:00:5569] I: __lws_header_table_detach: 
[496664|wsicli|0|WS/h1/libwebsockets.org|default|h1]: ah 0x2282dc0 
(tsi=0, count = 1)
[2021/02/09 19:21:00:5569] I: __lws_header_table_detach: nobody usable 
waiting
[2021/02/09 19:21:00:5569] I: _lws_destroy_ah: freed ah 0x2282dc0 : pool 
length 0
[2021/02/09 19:21:00:5569] I: __lws_header_table_detach: 
[496664|wsicli|0|WS/h1/libwebsockets.org|default|h1]: ah 0x2282dc0 
(tsi=0, count = 0)
[2021/02/09 19:21:00:5569] I: _lws_validity_confirmed_role: 
[496664|wsicli|0|WS/h1/libwebsockets.org|default|h1]: setting validity 
timer 3s (hup 0)
---> callback_minimal
[2021/02/09 19:21:00:5569] U: callback_minimal: established
---> callback_minimal
[2021/02/09 19:21:00:5570] N:
[2021/02/09 19:21:00:5570] N: 0000: 30 
                0
[2021/02/09 19:21:00:5570] N:
---> callback_minimal
[2021/02/09 19:21:00:6056] N:
[2021/02/09 19:21:00:6056] N: 0000: 31 
                1
[2021/02/09 19:21:00:6056] N:
---> callback_minimal
[2021/02/09 19:21:00:6062] N:
[2021/02/09 19:21:00:6062] N: 0000: 32 
                2
[2021/02/09 19:21:00:6062] N:
---> callback_minimal
...


More information about the Libwebsockets mailing list