Don't spam errors to the output if attempting to send a command to an unattached starting instance; closes pterodactyl/panel#2385

This commit is contained in:
Dane Everitt
2020-09-26 17:35:11 -07:00
parent a20861fa8e
commit 4748d7cb29
2 changed files with 19 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/pkg/errors"
"github.com/pterodactyl/wings/config"
"github.com/pterodactyl/wings/environment"
"github.com/pterodactyl/wings/environment/docker"
"github.com/pterodactyl/wings/router/tokens"
"github.com/pterodactyl/wings/server"
"net/http"
@@ -371,6 +372,18 @@ func (h *Handler) HandleInbound(m Message) error {
return nil
}
// TODO(dane): should probably add a new process state that is "booting environment" or something
// so that we can better handle this and only set the environment to booted once we're attached.
//
// Or maybe just an IsBooted function?
if h.server.GetState() == environment.ProcessStartingState {
if e, ok := h.server.Environment.(*docker.Environment); ok {
if !e.IsAttached() {
return nil
}
}
}
return h.server.Environment.SendCommand(strings.Join(m.Args, ""))
}
}