Wait for RCON connecting on FactorioServer.stop()

If the RCON client is currently in the process of connecting to the
Factorio server then wait for it to complete the connection to avoid it
emmiting out an error connecting in FactorioServer.stop().
This commit is contained in:
Hornwitser committed 2019-10-28 21:58:05 +01:00
1 parent 9082b40abd
commit a781c2f988
1 file changed
+7
+7
View File
@@ -620,6 +620,13 @@ class FactorioServer extends events.EventEmitter {
this._state = "stopping";
if (this._rconClient) {
// If RCON is not yet fully connected that operation needs to
// complete before the RCON connection can be closed cleanly.
if (!this._rconReady) {
await events.once(this, 'rcon-ready');
}
await this._rconClient.end();
}