Make API server datastructure

Added daemon field to it, will use it later for acces to daemon from
handlers

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov 2015-04-17 14:32:18 -07:00
parent b140321e2e
commit d6a49e79ac

View file

@ -32,7 +32,7 @@ import "net"
// NewListenBuffer returns a net.Listener listening on addr with the protocol // NewListenBuffer returns a net.Listener listening on addr with the protocol
// passed. The channel passed is used to activate the listenbuffer when the // passed. The channel passed is used to activate the listenbuffer when the
// caller is ready to accept connections. // caller is ready to accept connections.
func NewListenBuffer(proto, addr string, activate chan struct{}) (net.Listener, error) { func NewListenBuffer(proto, addr string, activate <-chan struct{}) (net.Listener, error) {
wrapped, err := net.Listen(proto, addr) wrapped, err := net.Listen(proto, addr)
if err != nil { if err != nil {
return nil, err return nil, err
@ -48,7 +48,7 @@ func NewListenBuffer(proto, addr string, activate chan struct{}) (net.Listener,
type defaultListener struct { type defaultListener struct {
wrapped net.Listener // The net.Listener wrapped by listenbuffer wrapped net.Listener // The net.Listener wrapped by listenbuffer
ready bool // Whether the listenbuffer has been activated ready bool // Whether the listenbuffer has been activated
activate chan struct{} // Channel to control activation of the listenbuffer activate <-chan struct{} // Channel to control activation of the listenbuffer
} }
// Close closes the wrapped socket. // Close closes the wrapped socket.