mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29: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 {
|
} else {
|
||||||
const [verb, , ...rest] = msg;
|
const [verb, , ...rest] = msg;
|
||||||
send([verb, subId, ...rest] as NostrRelayMsg);
|
send([verb, subId, ...rest] as NostrRelayMsg);
|
||||||
|
|
||||||
|
if (verb === 'CLOSED') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -182,6 +186,7 @@ function connectStream(socket: WebSocket, ip: string | undefined, opts: ConnectS
|
||||||
send(['CLOSED', subId, 'error: something went wrong']);
|
send(['CLOSED', subId, 'error: something went wrong']);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
controllers.get(subId)?.abort();
|
||||||
controllers.delete(subId);
|
controllers.delete(subId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue