update godeps

Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Victor Vieux 2016-01-15 18:30:36 -08:00
parent 68d053113d
commit d884fe563b
7 changed files with 36 additions and 16 deletions

2
Godeps/Godeps.json generated
View File

@ -167,7 +167,7 @@
},
{
"ImportPath": "github.com/samalba/dockerclient",
"Rev": "f661dd4754aa5c52da85d04b5871ee0e11f4b59c"
"Rev": "3c5f87482db1f82cf350f62aa5214aabd6016502"
},
{
"ImportPath": "github.com/samuel/go-zookeeper/zk",

View File

@ -47,10 +47,10 @@ func (e Error) Error() string {
}
func NewDockerClient(daemonUrl string, tlsConfig *tls.Config) (*DockerClient, error) {
return NewDockerClientTimeout(daemonUrl, tlsConfig, time.Duration(defaultTimeout))
return NewDockerClientTimeout(daemonUrl, tlsConfig, time.Duration(defaultTimeout), nil)
}
func NewDockerClientTimeout(daemonUrl string, tlsConfig *tls.Config, timeout time.Duration) (*DockerClient, error) {
func NewDockerClientTimeout(daemonUrl string, tlsConfig *tls.Config, timeout time.Duration, setUserTimeout tcpFunc) (*DockerClient, error) {
u, err := url.Parse(daemonUrl)
if err != nil {
return nil, err
@ -62,7 +62,7 @@ func NewDockerClientTimeout(daemonUrl string, tlsConfig *tls.Config, timeout tim
u.Scheme = "https"
}
}
httpClient := newHTTPClient(u, tlsConfig, timeout)
httpClient := newHTTPClient(u, tlsConfig, timeout, setUserTimeout)
return &DockerClient{u, httpClient, tlsConfig, 0, nil}, nil
}
@ -920,8 +920,8 @@ func (client *DockerClient) ConnectNetwork(id, container string) error {
return err
}
func (client *DockerClient) DisconnectNetwork(id, container string) error {
data, err := json.Marshal(NetworkDisconnect{Container: container})
func (client *DockerClient) DisconnectNetwork(id, container string, force bool) error {
data, err := json.Marshal(NetworkDisconnect{Container: container, Force: force})
if err != nil {
return err
}

View File

@ -54,6 +54,6 @@ type Client interface {
InspectNetwork(id string) (*NetworkResource, error)
CreateNetwork(config *NetworkCreate) (*NetworkCreateResponse, error)
ConnectNetwork(id, container string) error
DisconnectNetwork(id, container string) error
DisconnectNetwork(id, container string, force bool) error
RemoveNetwork(id string) error
}

View File

@ -216,8 +216,8 @@ func (client *MockClient) ConnectNetwork(id, container string) error {
return args.Error(0)
}
func (client *MockClient) DisconnectNetwork(id, container string) error {
args := client.Mock.Called(id, container)
func (client *MockClient) DisconnectNetwork(id, container string, force bool) error {
args := client.Mock.Called(id, container, force)
return args.Error(0)
}

View File

@ -182,7 +182,7 @@ func (client *NopClient) ConnectNetwork(id, container string) error {
return ErrNoEngine
}
func (client *NopClient) DisconnectNetwork(id, container string) error {
func (client *NopClient) DisconnectNetwork(id, container string, force bool) error {
return ErrNoEngine
}

View File

@ -279,11 +279,22 @@ type Container struct {
}
}
type Actor struct {
ID string
Attributes map[string]string
}
type Event struct {
Id string
Status string
From string
Time int64
Status string `json:"status,omitempty"`
ID string `json:"id,omitempty"`
From string `json:"from,omitempty"`
Type string
Action string
Actor Actor
Time int64 `json:"time,omitempty"`
TimeNano int64 `json:"timeNano,omitempty"`
}
type Version struct {
@ -551,4 +562,5 @@ type NetworkConnect struct {
// NetworkDisconnect represents the data to be used to disconnect a container from the network
type NetworkDisconnect struct {
Container string
Force bool
}

View File

@ -8,7 +8,9 @@ import (
"time"
)
func newHTTPClient(u *url.URL, tlsConfig *tls.Config, timeout time.Duration) *http.Client {
type tcpFunc func(*net.TCPConn, time.Duration) error
func newHTTPClient(u *url.URL, tlsConfig *tls.Config, timeout time.Duration, setUserTimeout tcpFunc) *http.Client {
httpTransport := &http.Transport{
TLSClientConfig: tlsConfig,
}
@ -16,7 +18,13 @@ func newHTTPClient(u *url.URL, tlsConfig *tls.Config, timeout time.Duration) *ht
switch u.Scheme {
default:
httpTransport.Dial = func(proto, addr string) (net.Conn, error) {
return net.DialTimeout(proto, addr, timeout)
conn, err := net.DialTimeout(proto, addr, timeout)
if tcpConn, ok := conn.(*net.TCPConn); ok && setUserTimeout != nil {
// Sender can break TCP connection if the remote side doesn't
// acknowledge packets within timeout
setUserTimeout(tcpConn, timeout)
}
return conn, err
}
case "unix":
socketPath := u.Path