summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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) {