mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Merge branch 'fix-mem-leak' into 'main'
Fix memory leak in relay? See merge request soapbox-pub/ditto!726
This commit is contained in:
commit
f95ab37b45
1 changed files with 5 additions and 0 deletions
|
|
@ -171,6 +171,10 @@ function connectStream(socket: WebSocket, ip: string | undefined, opts: ConnectS
|
|||
} else {
|
||||
const [verb, , ...rest] = msg;
|
||||
send([verb, subId, ...rest] as NostrRelayMsg);
|
||||
|
||||
if (verb === 'CLOSED') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
@ -182,6 +186,7 @@ function connectStream(socket: WebSocket, ip: string | undefined, opts: ConnectS
|
|||
send(['CLOSED', subId, 'error: something went wrong']);
|
||||
}
|
||||
} finally {
|
||||
controllers.get(subId)?.abort();
|
||||
controllers.delete(subId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue