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 <andy.green@linaro.org>
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 @@
 	{ "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 @@
 	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 <andy@warmcat.com> "
@@ -217,7 +219,7 @@
 		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 @@
 		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 @@
 			}
 
 			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 @@
 	fprintf(stderr, "Usage: libwebsockets-test-client "
 				"<server address> [--port=<p>] "
 				"[--ssl] [-k] [-v <ver>] "
-				"[-d <log bitfield>]\n");
+				"[-d <log bitfield>] [-l]\n");
 	return 1;
 }