Fix issue where closing a center's connections would kill it

This commit is contained in:
David Majdandžić
2023-04-06 20:26:31 +02:00
parent 5576de3f71
commit 1f9ed8122a
4 changed files with 9 additions and 1 deletions

View File

@@ -136,7 +136,6 @@ export default class Center extends SmppSession {
close(): Promise<void> {
return new Promise((resolve, reject) => {
this.logger.log1(`Center-${this.id} closing active connections`);
this.server.close();
this.sessions.forEach((session: any) => {
session.close();
});
@@ -145,6 +144,10 @@ export default class Center extends SmppSession {
});
}
destroy(): void {
this.server.close();
}
serialize(): object {
return {
id: this._id,

View File

@@ -73,6 +73,8 @@ export default class Client extends SmppSession {
super.defaultMultipleJob = job;
}
destroy(): void {}
doConnect(): PersistentPromise {
this.connectPromise = new PersistentPromise((resolve, reject) => {
if (this.status !== this.STATUSES[0]) {

View File

@@ -41,6 +41,7 @@ export default abstract class SessionManager {
return new Promise<void>((resolve, reject) => {
this.logger.log1(`Removing session with id ${session.id}`);
session.close();
session.destroy();
this.sessions = this.sessions.filter(s => s.id !== session.id);
resolve();
});

View File

@@ -125,6 +125,8 @@ export default abstract class SmppSession {
});
}
abstract destroy(): void;
sendSingle(job: Job): Promise<object> {
return this.sendPdu(job.pdu);
}