mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
Implement forwarding to instances for events
Implement forward to instance for Event messages.
This commit is contained in:
1 parent
e5115df28b
commit
513651393b
3 files changed
+49
-6
No files matched your search
@@ -268,6 +268,16 @@ class BaseConnection extends link.Link {
|
||||
return await request.send(connection, message.data);
|
||||
}
|
||||
|
||||
async forwardEventToInstance(message, event) {
|
||||
let instance = db.instance.get(message.data.instance_id);
|
||||
if (!instance) { return; }
|
||||
|
||||
let connection = slaveConnection.get(instance.slaveId);
|
||||
if (!connection) { return; }
|
||||
|
||||
event.send(connection, message.data);
|
||||
}
|
||||
|
||||
async broadcastEventToInstance(message, event) {
|
||||
for (let slaveConnection of slaveConnections.values()) {
|
||||
if (slaveConnection === this) {
|
||||
|
||||
Reference in new issue
Block a user