1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- // +build windows
- package server
- import (
- "errors"
- "net"
- "net/http"
- "github.com/docker/docker/context"
- "github.com/docker/docker/daemon"
- )
- // NewServer sets up the required Server and does protocol specific checking.
- func (s *Server) newServer(proto, addr string) ([]serverCloser, 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 []serverCloser
- for _, l := range ls {
- res = append(res, &HTTPServer{
- &http.Server{
- Addr: addr,
- Handler: s.router,
- },
- l,
- })
- }
- return res, nil
- }
- // AcceptConnections allows router to start listening for the incoming requests.
- func (s *Server) AcceptConnections(ctx context.Context, d *daemon.Daemon) {
- s.daemon = d
- s.registerSubRouter(ctx)
- // close the lock so the listeners start accepting connections
- select {
- case <-s.start:
- default:
- close(s.start)
- }
- }
- func allocateDaemonPort(addr string) error {
- return nil
- }
|