mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
html: handle an empty MAC table reply and fix the entry cap
l2.js reads the last index of a reply to know where the next page starts. With the firmware side of this branch an empty table answers [], and s[s.length-1] then throws on undefined. It used to answer commas with nothing between them and throw in JSON.parse instead, so this is the same case reaching a different line rather than a new one. An empty reply now renders what has been collected and starts the next pass from zero. The 4096 entry cap compared the array against the number instead of its length, so it never fired: an empty array and a 5000 element one both compare false. Comparing the length restores what the check was for.
This commit is contained in:
+6
-1
@@ -159,12 +159,17 @@ function getL2() {
|
|||||||
return e;
|
return e;
|
||||||
});
|
});
|
||||||
l2Entries.push(...s);
|
l2Entries.push(...s);
|
||||||
if (l2Entries >= 4096) {
|
if (l2Entries.length >= 4096) {
|
||||||
l2Entries = [];
|
l2Entries = [];
|
||||||
l2CurrentEntry = 0;
|
l2CurrentEntry = 0;
|
||||||
clearInterval(l2GetInterval);
|
clearInterval(l2GetInterval);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!s.length) {
|
||||||
|
l2CurrentEntry = 0;
|
||||||
|
fillL2(l2Entries);
|
||||||
|
return;
|
||||||
|
}
|
||||||
var w = 0;
|
var w = 0;
|
||||||
for (var i = l2Entries.length-1; i > 0; i--) {
|
for (var i = l2Entries.length-1; i > 0; i--) {
|
||||||
if (l2Entries[0].idx == l2Entries[i].idx) {
|
if (l2Entries[0].idx == l2Entries[i].idx) {
|
||||||
|
|||||||
Reference in New Issue
Block a user