mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 00:13:12 +09:00
Track plugins loaded by master and slaves
Send a mapping of the plugins the master server has loaded to slaves vice versa. Limit the plugins that may be loaded by instances to only those that the master server has loaded.
This commit is contained in:
1 parent
4060c75142
commit
1629eaf225
7 files changed
+53
-12
No files matched your search
@@ -31,6 +31,7 @@ let masterConfig;
|
||||
let masterConfigPath;
|
||||
let stopAcceptingNewSessions = false;
|
||||
let debugEvents = new events.EventEmitter();
|
||||
let pluginList = {};
|
||||
|
||||
// homebrew modules
|
||||
const generateSSLcert = require("lib/generateSSLcert");
|
||||
@@ -581,12 +582,14 @@ class SlaveConnection extends BaseConnection {
|
||||
this._id = registerData.id;
|
||||
this._name = registerData.name;
|
||||
this._version = registerData.version;
|
||||
this._plugins = registerData.plugins;
|
||||
|
||||
db.slaves.set(this._id, {
|
||||
agent: this._agent,
|
||||
id: this._id,
|
||||
name: this._name,
|
||||
version: this._version,
|
||||
plugins: this._plugins,
|
||||
});
|
||||
|
||||
this.connector.on("close", () => {
|
||||
@@ -863,7 +866,10 @@ wss.on("connection", function (socket, req) {
|
||||
};
|
||||
|
||||
// Start connection handshake.
|
||||
socket.send(JSON.stringify({ seq: null, type: "hello", data: { version }}));
|
||||
socket.send(JSON.stringify({ seq: null, type: "hello", data: {
|
||||
version,
|
||||
plugins: pluginList
|
||||
}}));
|
||||
|
||||
function attachHandler() {
|
||||
pendingSockets.add(socket);
|
||||
@@ -1000,6 +1006,8 @@ async function loadPlugins(pluginInfos) {
|
||||
continue;
|
||||
}
|
||||
|
||||
pluginList[pluginInfo.name] = pluginInfo.version;
|
||||
|
||||
let pluginLoadStarted = Date.now();
|
||||
let MasterPlugin = plugin.BaseMasterPlugin;
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user