mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
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:
1 parent
7430212ac8
commit
715ab343bf
2 files changed
+12
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user