Skip to content

Commit 5f60421

Browse files
committed
fix potential hang if a line handler returned the same data (does happen sometimes for Wifi/ESP8266)
1 parent 7b4b448 commit 5f60421

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/AT.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ exports.connect = function (ser) {
3636
if (dbg) console.log("] "+JSON.stringify(d));
3737
if (handlers) {
3838
for (var h in handlers) {
39-
while (line.substr(0,h.length)==h) {
40-
var pre = line;
39+
var pre;
40+
while (pre!=line && line.substr(0,h.length)==h) {
41+
pre = line;
4142
line = handlers[h](line);
4243
//if (dbg) console.log("HANDLER] "+JSON.stringify(pre)+"=>"+JSON.stringify(line)+" ("+h+")");
4344
}

0 commit comments

Comments
 (0)