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
Alexander Morozov 5eda566f93 Allocate resources for server API before daemon creation
It prevents occupying of those resources (ports, unix-sockets) by
containers.
Also fixed false-positive test for that case.

Fix #15912

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-10-05 09:32:08 -07:00

43 lines
689 B
Go

// +build windows
package server
import (
"errors"
"net"
"net/http"
)
// NewServer sets up the required Server and does protocol specific checking.
func (s *Server) newServer(proto, addr string) ([]*HTTPServer, error) {
var (
ls []net.Listener
)
switch proto {
case "tcp":
l, err := s.initTCPSocket(addr)
if err != nil {
return nil, err
}
ls = append(ls, l)
default:
return nil, errors.New("Invalid protocol format. Windows only supports tcp.")
}
var res []*HTTPServer
for _, l := range ls {
res = append(res, &HTTPServer{
&http.Server{
Addr: addr,
},
l,
})
}
return res, nil
}
func allocateDaemonPort(addr string) error {
return nil
}