mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-06-24 21:25:23 +00:00
Receivers: Fixed crash when ConnectionMonitor and ListenerService state is out-of-sync
This commit is contained in:
parent
c6106b8edc
commit
d69bd8fe92
2 changed files with 6 additions and 1 deletions
|
@ -70,6 +70,11 @@ export class ConnectionMonitor {
|
||||||
listener.send(Opcode.Ping, null, sessionId);
|
listener.send(Opcode.Ping, null, sessionId);
|
||||||
ConnectionMonitor.heartbeatRetries.set(sessionId, ConnectionMonitor.heartbeatRetries.get(sessionId) + 1);
|
ConnectionMonitor.heartbeatRetries.set(sessionId, ConnectionMonitor.heartbeatRetries.get(sessionId) + 1);
|
||||||
}
|
}
|
||||||
|
else if (listener.getSessionProtocolVersion(sessionId) === undefined) {
|
||||||
|
ConnectionMonitor.logger.warn(`Session ${sessionId} was not found in the list of active sessions. Removing...`);
|
||||||
|
ConnectionMonitor.backendConnections.delete(sessionId);
|
||||||
|
ConnectionMonitor.heartbeatRetries.delete(sessionId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, ConnectionMonitor.connectionPingTimeout);
|
}, ConnectionMonitor.connectionPingTimeout);
|
||||||
|
|
|
@ -82,7 +82,7 @@ export abstract class ListenerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getSessionProtocolVersion(sessionId: string) {
|
public getSessionProtocolVersion(sessionId: string) {
|
||||||
return this.sessionMap.get(sessionId).protocolVersion;
|
return this.sessionMap.get(sessionId)?.protocolVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
private isSubscribedToEvent(sessionId: string, event: EventSubscribeObject) {
|
private isSubscribedToEvent(sessionId: string, event: EventSubscribeObject) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue