Extract sockets initialization to a package.

Because I just used it somewhere else and it would be nice if I didn't have to copy and paste the code.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera
2015-05-20 16:48:39 -07:00
parent 2bf409d4ef
commit 0bfbc6e788
6 changed files with 37 additions and 31 deletions
+2 -8
View File
@@ -7,7 +7,6 @@ import (
"net"
"net/http"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon"
)
@@ -19,13 +18,8 @@ func (s *Server) newServer(proto, addr string) (Server, error) {
)
switch proto {
case "tcp":
if !s.cfg.TlsVerify {
logrus.Warn("/!\\ DON'T BIND ON ANY IP ADDRESS WITHOUT setting -tlsverify IF YOU DON'T KNOW WHAT YOU'RE DOING /!\\")
}
if l, err = NewTcpSocket(addr, tlsConfigFromServerConfig(s.cfg)); err != nil {
return nil, err
}
if err := allocateDaemonPort(addr); err != nil {
l, err = s.initTcpSocket(addr)
if err != nil {
return nil, err
}
default: