summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-05-04 11:52:59 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2012-05-04 11:52:59 +0200
commit0be8965219787e5ceb20721ac1ccd6cbbafe51c1 (patch)
tree847610ad83893100a47a4b54beaea6a2a1fb9602
parentba2094c0c735efc2677ab8c24bdf70ab70874a30 (diff)
Test client tweaks.
-rw-r--r--src/testclient.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/testclient.cc b/src/testclient.cc
index 5df0d56..3bdc02f 100644
--- a/src/testclient.cc
+++ b/src/testclient.cc
@@ -82,7 +82,10 @@ static int callback_task(struct libwebsocket_context *me,
case LWS_CALLBACK_CLIENT_RECEIVE:
fprintf(stderr, "rx %d '%s'\n", (int)len, (char *)in);
current_test->success = strncmp(current_test->result, (char*)in, len) == 0;
+
current_test++;
+ libwebsocket_callback_on_writable(me, wsi);
+
break;
case LWS_CALLBACK_CLIENT_WRITEABLE:
@@ -91,12 +94,15 @@ static int callback_task(struct libwebsocket_context *me,
l = sprintf((char *)&buf[LWS_SEND_BUFFER_PRE_PADDING],
"%s", current_test->command);
+ fprintf(stderr, "sx '%s'\n", &buf[LWS_SEND_BUFFER_PRE_PADDING]);
+
libwebsocket_write(wsi, &buf[LWS_SEND_BUFFER_PRE_PADDING],
l, LWS_WRITE_TEXT);
- if(current_test->result == NULL) current_test++;
-
- libwebsocket_callback_on_writable(me, wsi);
+ if(current_test->result == NULL) {
+ current_test++;
+ libwebsocket_callback_on_writable(me, wsi);
+ }
/*
* without at least this delay, we choke the browser
@@ -104,8 +110,8 @@ static int callback_task(struct libwebsocket_context *me,
* flow control
*/
- //usleep(200);
- sleep(1);
+ // usleep(200);
+ // sleep(1);
break;
default:
@@ -193,7 +199,7 @@ static struct test tests[] = {
{ NULL, NULL, false }
};
-client("holger", 10001, tests);
+client("localhost", 10001, tests);
struct test *t = &tests[0];
while(t->command) {