Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion amt/amt-redir-mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports.CreateAmtRedirect = function (module, domain, user, webserver, me
var obj = new require('stream').Duplex(options);
obj.forwardwrite = null;
obj.updateBuffer = function (chunk) { this.push(chunk); };
obj._write = function (chunk, encoding, callback) { if (obj.forwardwrite != null) { obj.forwardwrite(chunk); } else { console.err('Failed to fwd _write.'); } if (callback) callback(); }; // Pass data written to forward
obj._write = function (chunk, encoding, callback) { if (obj.forwardwrite != null) { obj.forwardwrite(chunk); } else { console.error('Failed to fwd _write.'); } if (callback) callback(); }; // Pass data written to forward
obj._read = function (size) { }; // Push nothing, anything to read should be pushed from updateBuffer()
return obj;
}
Comment on lines 81 to 87

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 SerialTunnel _write handler references undefined console.err instead of console.error

In the SerialTunnel function's obj._write implementation, replaced the invalid console.err('Failed to fwd _write.') call with console.error('Failed to fwd _write.'), fixing the undefined-method TypeError that would occur when obj.forwardwrite is null during a stream write.

πŸ€– Prompt for AI agents
In amt/amt-redir-mesh.js around line 78, review and complete this code-review fix: SerialTunnel _write handler references undefined console.err instead of console.error.
What the draft fix changed: In the `SerialTunnel` function's `obj._write` implementation, replaced the invalid `console.err('Failed to fwd _write.')` call with `console.error('Failed to fwd _write.')`, fixing the undefined-method TypeError that would occur when `obj.forwardwrite` is null during a stream write.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 98 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down Expand Up @@ -545,3 +545,4 @@ module.exports.CreateAmtRedirect = function (module, domain, user, webserver, me

function ToIntStr(v) { return String.fromCharCode((v & 0xFF), ((v >> 8) & 0xFF), ((v >> 16) & 0xFF), ((v >> 24) & 0xFF)); }
function ToShortStr(v) { return String.fromCharCode((v & 0xFF), ((v >> 8) & 0xFF)); }

Loading