Skip to content
Snippets Groups Projects
Commit 97b5e802 authored by Andy Green's avatar Andy Green
Browse files

minimal-ws-client: fix couple of breakages

parent fdf2c7ae
Branches
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ Option|Meaning
--server|Use a specific server instead of libwebsockets.org, eg `--server localhost`. Implies LCCSCF_ALLOW_SELFSIGNED
--port|Use a specific port instead of 443, eg `--port 7681`
-z|Send zero-length pings for testing
--protocol|Use a specific ws subprotocol rather than lws-mirror-protocol, eg, `--protocol myprotocol`
## usage
......
......@@ -19,7 +19,7 @@ static struct lws_context *context;
static struct lws *client_wsi;
static int interrupted, zero_length_ping, port = 443,
ssl_connection = LCCSCF_USE_SSL;
static const char *server_address = "libwebsockets.org", *pro = "lws-ping-test";
static const char *server_address = "libwebsockets.org", *pro = "lws-mirror-protocol";
struct pss {
int send_a_ping;
......@@ -40,7 +40,7 @@ connect_client(void)
i.origin = i.address;
i.ssl_connection = ssl_connection;
i.protocol = pro;
i.local_protocol_name = pro;
i.local_protocol_name = "lws-ping-test";
i.pwsi = &client_wsi;
return !lws_client_connect_via_info(&i);
......@@ -185,6 +185,9 @@ int main(int argc, const char **argv)
if (lws_cmdline_option(argc, argv, "-z"))
zero_length_ping = 1;
if ((p = lws_cmdline_option(argc, argv, "--protocol")))
pro = p;
if ((p = lws_cmdline_option(argc, argv, "--server"))) {
server_address = p;
pro = "lws-minimal";
......
......@@ -249,7 +249,7 @@ skip:
* We respond by scheduling a writable callback for the
* connected client, if any.
*/
if (vhd->client_wsi && vhd->established)
if (vhd && vhd->client_wsi && vhd->established)
lws_callback_on_writable(vhd->client_wsi);
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment