github.com/squaremo/docker@v1.3.2-0.20150516120342-42cfc9554972/api/server/server_windows.go (about) 1 // +build windows 2 3 package server 4 5 import ( 6 "errors" 7 "net" 8 "net/http" 9 10 "github.com/Sirupsen/logrus" 11 "github.com/docker/docker/daemon" 12 ) 13 14 // NewServer sets up the required Server and does protocol specific checking. 15 func (s *Server) newServer(proto, addr string) (Server, error) { 16 var ( 17 err error 18 l net.Listener 19 ) 20 switch proto { 21 case "tcp": 22 if !s.cfg.TlsVerify { 23 logrus.Warn("/!\\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\") 24 } 25 if l, err = NewTcpSocket(addr, tlsConfigFromServerConfig(s.cfg)); err != nil { 26 return nil, err 27 } 28 if err := allocateDaemonPort(addr); err != nil { 29 return nil, err 30 } 31 default: 32 return nil, errors.New("Invalid protocol format. Windows only supports tcp.") 33 } 34 return &HttpServer{ 35 &http.Server{ 36 Addr: addr, 37 Handler: s.router, 38 }, 39 l, 40 }, nil 41 } 42 43 func (s *Server) AcceptConnections(d *daemon.Daemon) { 44 s.daemon = d 45 // close the lock so the listeners start accepting connections 46 select { 47 case <-s.start: 48 default: 49 close(s.start) 50 } 51 }