mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 15:43:13 +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
@@ -131,6 +131,13 @@ class WebSocketClientConnector extends WebSocketBaseConnector {
|
||||
this._reconnectDelay = reconnectDelay;
|
||||
this._timeout = 15 * 60;
|
||||
this._startedReconnect = null;
|
||||
|
||||
/**
|
||||
* Mapping of plugin name to plugin version loaded on the master
|
||||
* server. Is `null` before handshake has taken place.
|
||||
* @member {?Object<string, string>}
|
||||
*/
|
||||
this.plugins = null;
|
||||
}
|
||||
|
||||
_check(expectedStates) {
|
||||
@@ -335,6 +342,7 @@ class WebSocketClientConnector extends WebSocketBaseConnector {
|
||||
let { seq, type, data } = message;
|
||||
if (type == 'hello') {
|
||||
console.log(`SOCKET | received hello from master version ${data.version}`);
|
||||
this.plugins = data.plugins;
|
||||
if (this._sessionToken) {
|
||||
console.log("SOCKET | Attempting resume");
|
||||
this.sendHandshake("resume", {
|
||||
|
||||
+10
-2
@@ -58,9 +58,13 @@ const serverHandshake = ajv.compile({
|
||||
"type": { const: "hello" },
|
||||
"data": {
|
||||
additionalProperties: false,
|
||||
required: ["version"],
|
||||
required: ["version", "plugins"],
|
||||
properties: {
|
||||
"version": { type: "string" },
|
||||
"plugins": {
|
||||
type: "object",
|
||||
additionalProperties: { type: "string" },
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -111,13 +115,17 @@ const clientHandshake = ajv.compile({
|
||||
"type": { const: "register_slave" },
|
||||
"data": {
|
||||
additionalProperties: false,
|
||||
required: ["token", "agent", "version", "name", "id"],
|
||||
required: ["token", "agent", "version", "name", "id", "plugins"],
|
||||
properties: {
|
||||
"token": { type: "string" },
|
||||
"agent": { type: "string" },
|
||||
"version": { type: "string" },
|
||||
"name": { type: "string" },
|
||||
"id": { type: "integer" },
|
||||
"plugins": {
|
||||
type: "object",
|
||||
additionalProperties: { type: "string" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user