mirror of
https://github.com/moby/moby.git
synced 2026-08-03 22:51:03 +00:00
Commit a0009345f5 updated the default
MaxRecvMsgSize and MaxSendMsgSize for Linux, but did not modify the
defaults for Windows. Those options should not be platform-specific,
which means that the only difference between the Linux and Windows
config are the addresses for GRPC and Debug (Windows defaulting
to a named pipe, whereas Linux sockets within exec-root).
This patch
- implements functions to return the default addresses for each platform
- moves the defaults into `supervisor.Start()`
- removes the now redundant `remote.setDefaults()` method
It's worth noting that prior to this path, `remove.setDefaults()` would
be applied _after_ any (custom) `DaemonOpt` was applied. However, none of
the existing `DaemonOpt` options currently mutates these options. `remote`
is also a non-exported type, so no external implementations can currently
be created. It is therefore safe to set these defaults before options are
applied.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
48 lines
979 B
Go
48 lines
979 B
Go
package supervisor // import "github.com/docker/docker/libcontainerd/supervisor"
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/docker/docker/pkg/process"
|
|
)
|
|
|
|
const (
|
|
grpcPipeName = `\\.\pipe\containerd-containerd`
|
|
debugPipeName = `\\.\pipe\containerd-debug`
|
|
)
|
|
|
|
func defaultGRPCAddress(stateDir string) string {
|
|
return grpcPipeName
|
|
}
|
|
|
|
func defaultDebugAddress(stateDir string) string {
|
|
return debugPipeName
|
|
}
|
|
|
|
func (r *remote) stopDaemon() {
|
|
p, err := os.FindProcess(r.daemonPid)
|
|
if err != nil {
|
|
r.logger.WithField("pid", r.daemonPid).Warn("could not find daemon process")
|
|
return
|
|
}
|
|
|
|
if err = p.Kill(); err != nil {
|
|
r.logger.WithError(err).WithField("pid", r.daemonPid).Warn("could not kill daemon process")
|
|
return
|
|
}
|
|
|
|
_, err = p.Wait()
|
|
if err != nil {
|
|
r.logger.WithError(err).WithField("pid", r.daemonPid).Warn("wait for daemon process")
|
|
return
|
|
}
|
|
}
|
|
|
|
func (r *remote) killDaemon() {
|
|
_ = process.Kill(r.daemonPid)
|
|
}
|
|
|
|
func (r *remote) platformCleanup() {
|
|
// Nothing to do
|
|
}
|