diff options
author | Pierre Ossman <ossman@cendio.se> | 2017-02-03 17:00:15 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-02-03 17:00:15 +0100 |
commit | 40238b00b61e509260e3093b0b353d5dcef6c413 (patch) | |
tree | 78eabd60b02beb8436eee2645e3ca0e042f7a09a /tests | |
parent | 3f8f301d7fb0c137a02eb6dfb2e20f80a4c05836 (diff) | |
download | websockify-40238b00b61e509260e3093b0b353d5dcef6c413.tar.gz |
Don't delay flushing
The native WebSocket is in a much better position to do queue
management than us. Many callers also failed to notice this part
of the API, causing stalls.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/latency.html | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/tests/latency.html b/tests/latency.html index 1c42653..90136a3 100644 --- a/tests/latency.html +++ b/tests/latency.html @@ -56,7 +56,7 @@ <script> - var host = null, port = null, sendDelay = 0, actualSendDelay, + var host = null, port = null, sendDelay = 0, ws = null, send_ref = null, sent, received, latencies, ltotal, laverage, lrunning, lmin, lmax, run_length = 40, @@ -153,19 +153,6 @@ function sendMsg() { var arr = []; - if (! ws.flush() ) { - message("WebSocket not ready, backing off"); - actualSendDelay = actualSendDelay * 2; - send_ref = setTimeout(sendMsg, actualSendDelay); - return false; - } else { - // Scale the delay down to the requested minimum - if (actualSendDelay > sendDelay) { - message("WebSocket ready, increasing presure"); - actualSendDelay = Math.max(actualSendDelay / 2, sendDelay); - } - } - timestamp = (new Date()).getTime(); arr.pushStr("^" + send_seq + ":" + timestamp + ":" + payload + "$"); send_seq ++; @@ -173,7 +160,7 @@ sent++; showStats(); - send_ref = setTimeout(sendMsg, actualSendDelay); + send_ref = setTimeout(sendMsg, sendDelay); } function showStats() { @@ -247,7 +234,6 @@ lrunning = 0; lmin = 999999999; lmax = 0; - actualSendDelay = sendDelay; $D('connectButton').value = "Stop"; $D('connectButton').onclick = disconnect; |