From 8ef50d28dee9eaf1f6091edaebc1df7a10d6a40c Mon Sep 17 00:00:00 2001 From: Andy Green Date: Sun, 13 Jan 2013 11:58:18 +0800 Subject: [PATCH] add longlived option to test client Needed to confirm pending timeouts won't kill the connection, by default it spams the server with connections that live less than 5s Signed-off-by: Andy Green --- test-server/test-client.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test-server/test-client.c b/test-server/test-client.c index 9f65269..afad928 100644 --- a/test-server/test-client.c +++ b/test-server/test-client.c @@ -194,6 +194,7 @@ static struct option options[] = { { "version", required_argument, NULL, 'v' }, { "undeflated", no_argument, NULL, 'u' }, { "nomux", no_argument, NULL, 'n' }, + { "longlived", no_argument, NULL, 'l' }, { NULL, 0, 0, 0 } }; @@ -208,6 +209,7 @@ int main(int argc, char **argv) struct libwebsocket *wsi_dumb; int ietf_version = -1; /* latest */ int mirror_lifetime = 0; + int longlived = 0; fprintf(stderr, "libwebsockets test client\n" "(C) Copyright 2010-2013 Andy Green " @@ -217,7 +219,7 @@ int main(int argc, char **argv) goto usage; while (n >= 0) { - n = getopt_long(argc, argv, "nuv:khsp:d:", options, NULL); + n = getopt_long(argc, argv, "nuv:khsp:d:l", options, NULL); if (n < 0) continue; switch (n) { @@ -230,6 +232,9 @@ int main(int argc, char **argv) case 'p': port = atoi(optarg); break; + case 'l': + longlived = 1; + break; case 'k': opts = LWS_WRITE_CLIENT_IGNORE_XOR_MASK; break; @@ -310,6 +315,9 @@ int main(int argc, char **argv) } mirror_lifetime = 10 + (random() & 1023); + /* useful to test single connection stability */ + if (longlived) + mirror_lifetime += 50000; fprintf(stderr, "opened mirror connection with " "%d lifetime\n", mirror_lifetime); @@ -340,6 +348,6 @@ usage: fprintf(stderr, "Usage: libwebsockets-test-client " " [--port=

] " "[--ssl] [-k] [-v ] " - "[-d ]\n"); + "[-d ] [-l]\n"); return 1; } -- 2.7.4