@solarisdk/browser 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/local-proxy.js +9 -0
- package/package.json +1 -1
package/dist/local-proxy.js
CHANGED
|
@@ -24,6 +24,15 @@ export class LocalProxy {
|
|
|
24
24
|
const addr = server.address();
|
|
25
25
|
this.server = server;
|
|
26
26
|
this.localPort = addr.port;
|
|
27
|
+
// Don't let the idle listener socket keep the Node event loop
|
|
28
|
+
// alive. While a session is active the browser's connection
|
|
29
|
+
// THROUGH this proxy is a live socket that holds the process
|
|
30
|
+
// open on its own; once the caller does `browser.close()` and
|
|
31
|
+
// those drain, an un-unref'd listener would still block exit,
|
|
32
|
+
// so a script that never calls `client.close()` hangs forever.
|
|
33
|
+
// unref() fixes that footgun while leaving active proxying and
|
|
34
|
+
// retries untouched (only the listener stops pinning the loop).
|
|
35
|
+
server.unref();
|
|
27
36
|
server.off("error", reject);
|
|
28
37
|
server.on("error", (err) => {
|
|
29
38
|
console.error("[solari-sdk:local-proxy] server error:", err);
|