mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 15:43:13 +09:00
Merge branch 'master' into feature/instance-version-2
This commit is contained in:
102 files changed
+1289
-340
No files matched your search
@@ -261,6 +261,7 @@ export interface InstanceConfigFields {
|
||||
"instance.auto_start": boolean;
|
||||
|
||||
"factorio.version": string;
|
||||
"factorio.executable_path": string | null;
|
||||
"factorio.game_port": number | null;
|
||||
"factorio.host_assigned_game_port": number | null;
|
||||
"factorio.rcon_port": number | null;
|
||||
@@ -311,6 +312,14 @@ export class InstanceConfig extends classes.Config<InstanceConfigFields> {
|
||||
type: "string",
|
||||
initialValue: "latest",
|
||||
},
|
||||
"factorio.executable_path": {
|
||||
description:
|
||||
"Relative path from the Factorio installation directory to the executable to run. " +
|
||||
"Defaults to auto detect the path, only needed in special setups.",
|
||||
restartRequired: true,
|
||||
type: "string",
|
||||
optional: true,
|
||||
},
|
||||
"factorio.game_port": {
|
||||
description: "UDP port to run game on, uses a port in host.factorio_port_range if null",
|
||||
restartRequired: true,
|
||||
|
||||
@@ -34,6 +34,7 @@ export abstract class BaseConnector extends events.EventEmitter {
|
||||
}
|
||||
|
||||
protected abstract send(message: libData.MessageRoutable): void;
|
||||
abstract get valid(): boolean;
|
||||
|
||||
forward(message: libData.MessageRoutable) {
|
||||
const seq = this._seq;
|
||||
@@ -346,6 +347,14 @@ export abstract class WebSocketBaseConnector extends BaseConnector {
|
||||
get hasSession() {
|
||||
return ["connected", "resuming"].includes(this._state);
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the connector is valid and can accept new messages,
|
||||
* only needs to be checked on fringe cases during setup and tear down.
|
||||
*/
|
||||
get valid() {
|
||||
return this.hasSession;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -723,4 +732,14 @@ export class VirtualConnector extends BaseConnector {
|
||||
send(message: libData.Message) {
|
||||
this.other.emit("message", message);
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the connector is valid and can accept new messages,
|
||||
* only needs to be checked on fringe cases during setup and tear down.
|
||||
*
|
||||
* For a virtual connector this is always true.
|
||||
*/
|
||||
get valid() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -538,6 +538,9 @@ export class Link {
|
||||
if (!entry) {
|
||||
throw new Error(`Attempt to send unregistered Request ${request.constructor.name}`);
|
||||
}
|
||||
if (this.connector.src.addressedTo(dst)) {
|
||||
throw new Error(`Message would return back to sender ${dst}.`);
|
||||
}
|
||||
if (this.validateSent) {
|
||||
entry.requestFromJSON(JSON.parse(JSON.stringify(request)));
|
||||
}
|
||||
@@ -572,6 +575,9 @@ export class Link {
|
||||
if (!entry) {
|
||||
throw new Error(`Attempt to send unregistered Event ${event.constructor.name}`);
|
||||
}
|
||||
if (this.connector.src.addressedTo(dst)) {
|
||||
throw new Error(`Message would return back to sender ${dst}.`);
|
||||
}
|
||||
if (this.validateSent) {
|
||||
entry.eventFromJSON(JSON.parse(JSON.stringify(event)));
|
||||
}
|
||||
|
||||
@@ -207,7 +207,9 @@ export class LinkTransport extends Transport {
|
||||
}
|
||||
|
||||
try {
|
||||
this.link.send(new libData.LogMessageEvent(info));
|
||||
if (this.link.connector.valid) {
|
||||
this.link.send(new libData.LogMessageEvent(info));
|
||||
}
|
||||
} catch (err) {
|
||||
// Ignore session lost errors.
|
||||
if (!(err instanceof libErrors.SessionLost)) {
|
||||
|
||||
Reference in new issue
Block a user