Explicitly drop events events to the master if no session exists

Since the connector refactor the action of sending a message on a
connector that is in the process of connecting changed from queuing up
the message to send it to throwing an error.  To avoid events forwarded
by the slave to to the master when the connection is down from being
logged as an error forwardEventToMaster has to explicitly drop them.
This commit is contained in:
Hornwitser committed 2021-09-11 04:18:17 +02:00
1 parent 7430212ac8
commit 715ab343bf
2 files changed
+12

No files matched your search

+8
View File
@@ -163,6 +163,14 @@ class WebSocketBaseConnector extends events.EventEmitter {
get closing() {
return this._closing || this._state === "closed";
}
/**
* True if the connector currently has a valid session that is either
* connected or in the process of resuming.
*/
get hasSession() {
return ["connected", "resuming"].includes(this._state);
}
}
/**
+4
View File
@@ -945,6 +945,10 @@ class InstanceConnection extends libLink.Link {
}
async forwardEventToMaster(message, event) {
if (!this.slave.connector.hasSession) {
return;
}
event.send(this.slave, message.data);
}