galexrt / srcds_exporter

Prometheus exporter for SRCDS Gameserver using Source RCON.
Apache License 2.0
25 stars 6 forks source link

Fixed issue where RCON connections will panic #8

Closed solidDoWant closed 1 year ago

solidDoWant commented 1 year ago

Currently RCON connections will panic because the RCON.rcon field is nil upon call to NewRCON, despite created being set to the current time. Because created is set to the current time, runRCONCommand will not call RCON.Reconnect to establish a connection to the server, resulting a panic due to accessing a nil pointer. This PR sets the initial created time to Unix Epoch time, ensuring that the connection to the RCON server is established.