mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 17:42:09 +00:00
fix(multiplayer): bound adapter HTTP calls
This commit is contained in:
@@ -106,7 +106,10 @@ type Supervisor struct {
|
||||
lastGameServer GameServer
|
||||
}
|
||||
|
||||
const DefaultDrainGrace = 285 * time.Second
|
||||
const (
|
||||
DefaultDrainGrace = 285 * time.Second
|
||||
DefaultHTTPTimeout = 10 * time.Second
|
||||
)
|
||||
|
||||
func New(config Config) (*Supervisor, error) {
|
||||
if len(config.Command) == 0 || config.Command[0] == "" {
|
||||
@@ -131,7 +134,7 @@ func New(config Config) (*Supervisor, error) {
|
||||
return nil, fmt.Errorf("unsupported transport %q", config.Transport)
|
||||
}
|
||||
if config.HTTPClient == nil {
|
||||
config.HTTPClient = http.DefaultClient
|
||||
config.HTTPClient = &http.Client{Timeout: DefaultHTTPTimeout}
|
||||
}
|
||||
if (config.DrainURL == "") != (config.DrainToken == "") {
|
||||
return nil, fmt.Errorf("drain URL and token must be configured together")
|
||||
|
||||
Reference in New Issue
Block a user