Extract function to listen on Unix socket

This commit is contained in:
Bryan Boreham committed 2016-02-01 10:11:46 +00:00
1 parent c2a869491f
commit 78f2d82984
3 files changed
+22 -11

No files matched your search

+2 -7
View File
@@ -11,6 +11,7 @@ import (
"github.com/docker/libnetwork/ipamapi"
. "github.com/weaveworks/weave/common"
"github.com/weaveworks/weave/common/docker"
weavenet "github.com/weaveworks/weave/net"
ipamplugin "github.com/weaveworks/weave/plugin/ipam"
netplugin "github.com/weaveworks/weave/plugin/net"
"github.com/weaveworks/weave/plugin/skel"
@@ -101,13 +102,7 @@ func listenAndServe(dockerClient *docker.Client, address string, noMulticastRout
}
}
var listener net.Listener
// remove sockets from last invocation
if err := os.Remove(address); err != nil && !os.IsNotExist(err) {
return nil, err
}
listener, err = net.Listen("unix", address)
listener, err := weavenet.ListenUnixSocket(address)
if err != nil {
return nil, err
}