server_windows.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // +build windows
  2. package server
  3. import (
  4. "errors"
  5. "net"
  6. "net/http"
  7. "github.com/docker/docker/context"
  8. "github.com/docker/docker/daemon"
  9. )
  10. // NewServer sets up the required Server and does protocol specific checking.
  11. func (s *Server) newServer(proto, addr string) ([]serverCloser, error) {
  12. var (
  13. ls []net.Listener
  14. )
  15. switch proto {
  16. case "tcp":
  17. l, err := s.initTCPSocket(addr)
  18. if err != nil {
  19. return nil, err
  20. }
  21. ls = append(ls, l)
  22. default:
  23. return nil, errors.New("Invalid protocol format. Windows only supports tcp.")
  24. }
  25. var res []serverCloser
  26. for _, l := range ls {
  27. res = append(res, &HTTPServer{
  28. &http.Server{
  29. Addr: addr,
  30. Handler: s.router,
  31. },
  32. l,
  33. })
  34. }
  35. return res, nil
  36. }
  37. // AcceptConnections allows router to start listening for the incoming requests.
  38. func (s *Server) AcceptConnections(ctx context.Context, d *daemon.Daemon) {
  39. s.daemon = d
  40. s.registerSubRouter(ctx)
  41. // close the lock so the listeners start accepting connections
  42. select {
  43. case <-s.start:
  44. default:
  45. close(s.start)
  46. }
  47. }
  48. func allocateDaemonPort(addr string) error {
  49. return nil
  50. }