Remove usage of listenbuffer package

It actually adds nothing to queuing requests.

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov 2015-11-25 11:05:31 -08:00
parent 49dc2e55d9
commit 9e281d40d0
2 changed files with 4 additions and 11 deletions

View file

@ -7,17 +7,13 @@ import (
"net" "net"
"net/http" "net/http"
"time" "time"
"github.com/docker/docker/pkg/listenbuffer"
) )
// NewTCPSocket creates a TCP socket listener with the specified address and // NewTCPSocket creates a TCP socket listener with the specified address and
// and the specified tls configuration. If TLSConfig is set, will encapsulate the // and the specified tls configuration. If TLSConfig is set, will encapsulate the
// TCP listener inside a TLS one. // TCP listener inside a TLS one.
// The channel passed is used to activate the listenbuffer when the caller is ready func NewTCPSocket(addr string, tlsConfig *tls.Config) (net.Listener, error) {
// to accept connections. l, err := net.Listen("tcp", addr)
func NewTCPSocket(addr string, tlsConfig *tls.Config, activate <-chan struct{}) (net.Listener, error) {
l, err := listenbuffer.NewListenBuffer("tcp", addr, activate)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -10,20 +10,17 @@ import (
"syscall" "syscall"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/listenbuffer"
"github.com/opencontainers/runc/libcontainer/user" "github.com/opencontainers/runc/libcontainer/user"
) )
// NewUnixSocket creates a unix socket with the specified path and group. // NewUnixSocket creates a unix socket with the specified path and group.
// The channel passed is used to activate the listenbuffer when the caller is ready func NewUnixSocket(path, group string) (net.Listener, error) {
// to accept connections.
func NewUnixSocket(path, group string, activate <-chan struct{}) (net.Listener, error) {
if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) { if err := syscall.Unlink(path); err != nil && !os.IsNotExist(err) {
return nil, err return nil, err
} }
mask := syscall.Umask(0777) mask := syscall.Umask(0777)
defer syscall.Umask(mask) defer syscall.Umask(mask)
l, err := listenbuffer.NewListenBuffer("unix", path, activate) l, err := net.Listen("unix", path)
if err != nil { if err != nil {
return nil, err return nil, err
} }