Skip to content

Commit 495d0bd

Browse files
author
Jan Naahs
committed
Fix open RCon session
1 parent 46ae36a commit 495d0bd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/factorio_server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ func initFactorio() (f *FactorioServer, err error) {
139139
f.BaseModVersion = modInfo.Version
140140

141141
// load admins from additional file
142-
if(f.Version.Greater(Version{0,17,0})) {
142+
if (f.Version.Greater(Version{0, 17, 0})) {
143143
if _, err := os.Stat(filepath.Join(config.FactorioConfigDir, config.FactorioAdminFile)); os.IsNotExist(err) {
144144
//save empty admins-file
145145
ioutil.WriteFile(filepath.Join(config.FactorioConfigDir, config.FactorioAdminFile), []byte("[]"), 0664)
@@ -190,7 +190,7 @@ func (f *FactorioServer) Run() error {
190190
"--rcon-port", strconv.Itoa(config.FactorioRconPort),
191191
"--rcon-password", config.FactorioRconPass)
192192

193-
if(f.Version.Greater(Version{0,17,0})) {
193+
if (f.Version.Greater(Version{0, 17, 0})) {
194194
args = append(args, "--server-adminlist", filepath.Join(config.FactorioConfigDir, config.FactorioAdminFile))
195195
}
196196

@@ -265,11 +265,11 @@ func (f *FactorioServer) parseRunningCommand(std io.ReadCloser) (err error) {
265265
}
266266
}
267267
// If rcon port opens indicated in log connect to rcon
268-
rconLog := "Starting RCON interface at port " + strconv.Itoa(config.FactorioRconPort)
268+
rconLog := "Starting RCON interface at IP"
269269
// check if slice index is greater than 2 to prevent panic
270270
if len(line) > 2 {
271271
// log line for opened rcon connection
272-
if strings.Join(line[3:], " ") == rconLog {
272+
if strings.Contains(strings.Join(line, " "), rconLog) {
273273
log.Printf("Rcon running on Factorio Server")
274274
err = connectRC()
275275
if err != nil {

0 commit comments

Comments
 (0)