1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/api/server/server_windows.go
Darren Shepherd 7433c9c92a Make server_windows.go consistent with server_linux.go
Signed-off-by: Darren Shepherd <darren@rancher.com>
2015-04-01 17:31:15 -07:00

50 lines
1.1 KiB
Go

// +build windows
package server
import (
"errors"
"net"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/engine"
)
// NewServer sets up the required Server and does protocol specific checking.
func NewServer(proto, addr string, job *engine.Job) (Server, error) {
var (
err error
l net.Listener
r = createRouter(
job.Eng,
job.GetenvBool("Logging"),
job.GetenvBool("EnableCors"),
job.Getenv("CorsHeaders"),
job.Getenv("Version"),
)
)
switch proto {
case "tcp":
if !job.GetenvBool("TlsVerify") {
logrus.Infof("/!\\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\")
}
if l, err = NewTcpSocket(addr, tlsConfigFromJob(job)); err != nil {
return nil, err
}
if err := allocateDaemonPort(addr); err != nil {
return nil, err
}
default:
return nil, errors.New("Invalid protocol format. Windows only supports tcp.")
}
}
// Called through eng.Job("acceptconnections")
func AcceptConnections(job *engine.Job) error {
// close the lock so the listeners start accepting connections
select {
case <-activationLock:
default:
close(activationLock)
}
return nil
}