Skip to content

Commit 06452f5

Browse files
committed
fix: small workaround for duplicate close
1 parent 36dc966 commit 06452f5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/puter-js/src/lib/http.js

+6
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,13 @@ export const make_http_api = ({ Socket, DEFAULT_PORT }) => {
165165
sock.on('error', (err) => {
166166
req.emit('error', err);
167167
});
168+
let closed = false;
168169
sock.on('close', () => {
170+
if ( closed ) {
171+
console.error('close event after closed');
172+
return;
173+
}
174+
closed = true;
169175
if ( buffer ) {
170176
console.log('close with buffer', buffer);
171177
const bin = encoder.encode(buffer);

0 commit comments

Comments
 (0)