Move responsibility of handling unsubscription on close

Notify the SubscriptionController that a connection closed from the
Connection instead of having the subscription controller set up an event
to do so.  This simplifies the logic on the SubscriptionController's
side.
This commit is contained in:
Hornwitser committed 2023-12-11 21:47:15 +01:00
1 parent 0df672ecca
commit 1d729adbb7
3 files changed
+39 -17

No files matched your search

@@ -33,6 +33,10 @@ export default class BaseConnection extends lib.Link {
this.handle(lib.ModPackGetRequest, this.handleModPackGetRequest.bind(this));
this.handle(lib.ModPackGetDefaultRequest, this.handleModPackGetDefaultRequest.bind(this));
this.handle(lib.ModDownloadRequest, this.handleModDownloadRequest.bind(this));
this.connector.on("close", () => {
this._controller.subscriptions.unsubscribe(this);
});
}
async disconnect(code: number, reason: string) {