From ff480dd6f5b6148d5afe95d0a0cc9130f1aa7555 Mon Sep 17 00:00:00 2001 From: jhen Date: Sat, 22 Jul 2023 09:04:44 +0800 Subject: [PATCH] [NPM package] Set fixed host for net.createConnection --- npm-package/lib/injectDevToolsMiddleware.tmpl.js | 2 +- npm-package/src/open.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/npm-package/lib/injectDevToolsMiddleware.tmpl.js b/npm-package/lib/injectDevToolsMiddleware.tmpl.js index 5ec97258..cf951405 100644 --- a/npm-package/lib/injectDevToolsMiddleware.tmpl.js +++ b/npm-package/lib/injectDevToolsMiddleware.tmpl.js @@ -18,7 +18,7 @@ function __connectToRND(rndPath, log, cb) { ); return cb(false); } - var __c = __net.createConnection({ port: __port }, () => { + var __c = __net.createConnection({ host: '127.0.0.1', port: __port }, () => { let pass = false; __c.setEncoding('utf-8'); __c.write(JSON.stringify({ path: rndPath })); diff --git a/npm-package/src/open.js b/npm-package/src/open.js index 047867d3..332ff672 100644 --- a/npm-package/src/open.js +++ b/npm-package/src/open.js @@ -20,7 +20,7 @@ function connectToRND(rndPath, log, cb) { } return cb(false); } - const connection = net.createConnection({ port }, () => { + const connection = net.createConnection({ host: '127.0.0.1', port }, () => { let pass = false; connection.setEncoding('utf-8'); connection.write(JSON.stringify({ path: rndPath }));