Change wstest.html 'cnt' to 'seq'.
This commit is contained in:
parent
f9583f1f98
commit
8acfc8cf52
20
wstest.html
20
wstest.html
|
@ -54,7 +54,7 @@
|
||||||
var ws = null, update_ref = null, send_ref = null;
|
var ws = null, update_ref = null, send_ref = null;
|
||||||
var sent = 0, received = 0, errors = 0;
|
var sent = 0, received = 0, errors = 0;
|
||||||
var max_send = 2000;
|
var max_send = 2000;
|
||||||
var recv_cnt = 0, send_cnt = 0;
|
var recv_seq = 0, send_seq = 0;
|
||||||
|
|
||||||
Array.prototype.pushStr = function (str) {
|
Array.prototype.pushStr = function (str) {
|
||||||
var n = str.length;
|
var n = str.length;
|
||||||
|
@ -89,19 +89,19 @@
|
||||||
arr = decoded.map(function(num) {
|
arr = decoded.map(function(num) {
|
||||||
return String.fromCharCode(num);
|
return String.fromCharCode(num);
|
||||||
} ).join('').split(':');
|
} ).join('').split(':');
|
||||||
cnt = arr[0];
|
seq = arr[0];
|
||||||
length = arr[1];
|
length = arr[1];
|
||||||
chksum = arr[2];
|
chksum = arr[2];
|
||||||
nums = arr[3];
|
nums = arr[3];
|
||||||
|
|
||||||
//console.log(" length:" + length + " chksum:" + chksum + " nums:" + nums);
|
//console.log(" length:" + length + " chksum:" + chksum + " nums:" + nums);
|
||||||
if (cnt != recv_cnt) {
|
if (seq != recv_seq) {
|
||||||
errors++;
|
errors++;
|
||||||
error("Expected count " + recv_cnt + " but got " + cnt);
|
error("Expected seq " + recv_seq + " but got " + seq);
|
||||||
recv_cnt = parseInt(cnt,10) + 1; // Back on track
|
recv_seq = parseInt(seq,10) + 1; // Back on track
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
recv_cnt++;
|
recv_seq++;
|
||||||
if (nums.length != length) {
|
if (nums.length != length) {
|
||||||
errors++;
|
errors++;
|
||||||
error("Expected length " + length + " but got " + nums.length);
|
error("Expected length " + length + " but got " + nums.length);
|
||||||
|
@ -138,8 +138,8 @@
|
||||||
chksum += parseInt(numlist[i], 10);
|
chksum += parseInt(numlist[i], 10);
|
||||||
}
|
}
|
||||||
var nums = numlist.join('');
|
var nums = numlist.join('');
|
||||||
arr.pushStr("^" + send_cnt + ":" + length + ":" + chksum + ":" + nums + "$")
|
arr.pushStr("^" + send_seq + ":" + length + ":" + chksum + ":" + nums + "$")
|
||||||
send_cnt ++;
|
send_seq ++;
|
||||||
ws.send(Base64.encode(arr));
|
ws.send(Base64.encode(arr));
|
||||||
sent++;
|
sent++;
|
||||||
}
|
}
|
||||||
|
@ -216,8 +216,8 @@
|
||||||
|
|
||||||
$clear(update_ref);
|
$clear(update_ref);
|
||||||
update_stats(); // Final numbers
|
update_stats(); // Final numbers
|
||||||
recv_cnt = 0;
|
recv_seq = 0;
|
||||||
send_cnt = 0;
|
send_seq = 0;
|
||||||
|
|
||||||
$('connectButton').value = "Start";
|
$('connectButton').value = "Start";
|
||||||
$('connectButton').onclick = connect;
|
$('connectButton').onclick = connect;
|
||||||
|
|
Loading…
Reference in New Issue