This commit is contained in:
onyx-and-iris 2024-11-04 17:46:11 +00:00
parent a7702c8050
commit 05ee3f1912
2 changed files with 5 additions and 4 deletions

View File

@ -54,7 +54,9 @@ func main() {
#### `WithLoginTimeout(timeout time.Duration)` #### `WithLoginTimeout(timeout time.Duration)`
If the server was just started or is currently performing a long operation like map rotating then it's possible to receive empty rcon responses. In which case you'll want to retry login. Use this functional option to set the max timeout for logins, it defaults to 5 seconds. For example: If the server was just started or is currently performing a long operation like map rotating then it's possible to receive empty rcon responses. In which case you'll want to retry login. Use this functional option to set the max timeout for logins, it defaults to 5 seconds.
For example:
```go ```go
rcon, err := q3rcon.New( rcon, err := q3rcon.New(
@ -64,7 +66,7 @@ rcon, err := q3rcon.New(
#### `WithDefaultTimeout(timeout time.Duration)` #### `WithDefaultTimeout(timeout time.Duration)`
You may want to change the default timeout if some of your responses are getting mixed together (stability can depend on connection to the server). For example, on LAN I can leave the default at 20ms, when connecting remotely I normally increase this to 50ms. You may want to change the default timeout if some of your responses are getting mixed together (stability can depend on connection to the server). For example, over localhost I can leave the default at 20ms, when connecting remotely I normally increase this to 50ms.
For example: For example:

View File

@ -68,8 +68,7 @@ func main() {
} }
func connectRcon(host string, port int, password string) (*q3rcon.Rcon, error) { func connectRcon(host string, port int, password string) (*q3rcon.Rcon, error) {
rcon, err := q3rcon.New( rcon, err := q3rcon.New(host, port, password)
host, port, password)
if err != nil { if err != nil {
return nil, err return nil, err
} }