2015-02-13 14:46:14 -05:00
|
|
|
// +build windows
|
2015-04-17 06:05:30 -04:00
|
|
|
|
2015-02-13 14:46:14 -05:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
2015-03-31 16:37:49 -04:00
|
|
|
"errors"
|
|
|
|
"net"
|
2015-04-17 17:32:18 -04:00
|
|
|
"net/http"
|
2015-02-13 14:46:14 -05:00
|
|
|
|
2015-04-17 17:32:18 -04:00
|
|
|
"github.com/docker/docker/daemon"
|
2015-06-12 16:00:59 -04:00
|
|
|
"github.com/docker/docker/pkg/version"
|
|
|
|
"github.com/docker/docker/runconfig"
|
2015-02-13 14:46:14 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// NewServer sets up the required Server and does protocol specific checking.
|
2015-05-30 00:25:27 -04:00
|
|
|
func (s *Server) newServer(proto, addr string) ([]serverCloser, error) {
|
2015-03-31 16:37:49 -04:00
|
|
|
var (
|
2015-05-30 00:25:27 -04:00
|
|
|
ls []net.Listener
|
2015-03-31 16:37:49 -04:00
|
|
|
)
|
2015-02-13 14:46:14 -05:00
|
|
|
switch proto {
|
|
|
|
case "tcp":
|
2015-05-30 00:25:27 -04:00
|
|
|
l, err := s.initTcpSocket(addr)
|
2015-05-20 19:48:39 -04:00
|
|
|
if err != nil {
|
2015-03-31 16:37:49 -04:00
|
|
|
return nil, err
|
|
|
|
}
|
2015-05-30 00:25:27 -04:00
|
|
|
ls = append(ls, l)
|
2015-05-15 16:05:35 -04:00
|
|
|
|
2015-02-13 14:46:14 -05:00
|
|
|
default:
|
|
|
|
return nil, errors.New("Invalid protocol format. Windows only supports tcp.")
|
|
|
|
}
|
2015-05-30 00:25:27 -04:00
|
|
|
|
|
|
|
var res []serverCloser
|
|
|
|
for _, l := range ls {
|
|
|
|
res = append(res, &HttpServer{
|
|
|
|
&http.Server{
|
|
|
|
Addr: addr,
|
|
|
|
Handler: s.router,
|
|
|
|
},
|
|
|
|
l,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
return res, nil
|
|
|
|
|
2015-02-13 14:46:14 -05:00
|
|
|
}
|
2015-02-13 18:08:42 -05:00
|
|
|
|
2015-04-17 17:32:18 -04:00
|
|
|
func (s *Server) AcceptConnections(d *daemon.Daemon) {
|
|
|
|
s.daemon = d
|
2015-05-20 08:20:19 -04:00
|
|
|
s.registerSubRouter()
|
2015-02-13 18:08:42 -05:00
|
|
|
// close the lock so the listeners start accepting connections
|
2015-04-01 20:26:22 -04:00
|
|
|
select {
|
2015-04-17 17:32:18 -04:00
|
|
|
case <-s.start:
|
2015-04-01 20:26:22 -04:00
|
|
|
default:
|
2015-04-17 17:32:18 -04:00
|
|
|
close(s.start)
|
2015-02-13 18:08:42 -05:00
|
|
|
}
|
|
|
|
}
|
2015-05-15 16:05:35 -04:00
|
|
|
|
|
|
|
func allocateDaemonPort(addr string) error {
|
|
|
|
return nil
|
|
|
|
}
|
2015-06-03 15:01:53 -04:00
|
|
|
|
|
|
|
func adjustCpuShares(version version.Version, hostConfig *runconfig.HostConfig) {
|
|
|
|
}
|