Skip to content

Commit eb7c3ae

Browse files
committed
fix: clean up
1 parent 322a595 commit eb7c3ae

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

shared/modules/caip-stream.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ export const createCaipStream = (portStream: Duplex): Duplex => {
7676
}
7777
};
7878

79-
/* ---------- 1. Listen for tab / iframe shutdown signals ---------- */
80-
79+
// 1. Listen for tab/iframe shutdown signals
8180
// a. Node-style streams emit 'close' and/or 'end'
8281
portStream.once?.('close', handlePortGone);
8382
portStream.once?.('end', handlePortGone);
@@ -88,12 +87,10 @@ export const createCaipStream = (portStream: Duplex): Duplex => {
8887
const rawPort: chrome.runtime.Port | undefined = (portStream as any)?._port;
8988
rawPort?.onDisconnect?.addListener(handlePortGone);
9089

91-
/* ---------- 2. Wire up the full duplex pipeline ---------- */
92-
90+
// 2. Wire up the full duplex pipeline
9391
pipeline(portStream, caipStream, portStream, (err: Error | null) => {
94-
caipStream.substream.destroy(); // full cleanup
92+
caipStream.substream.destroy();
9593

96-
// Ignore the normal premature-close that used to spam the console
9794
if (err && err.message !== 'Premature close') {
9895
console.error('MetaMask CAIP stream error:', err);
9996
}

0 commit comments

Comments
 (0)