Merge branch '1.5'
This commit is contained in:
commit
f7bddab4cb
1 file changed
+3
-3
+3
-3
@@ -38,7 +38,7 @@ func writeAddresses(w http.ResponseWriter, cidrs []address.CIDR) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func hasBeenCanceled(dockerCli *docker.Client, closedChan <-chan bool, ident string, checkAlive bool) func() bool {
|
func hasBeenCancelled(dockerCli *docker.Client, closedChan <-chan bool, ident string, checkAlive bool) func() bool {
|
||||||
return func() bool {
|
return func() bool {
|
||||||
select {
|
select {
|
||||||
case <-closedChan:
|
case <-closedChan:
|
||||||
@@ -62,7 +62,7 @@ func cancellationErr(w http.ResponseWriter, err error) bool {
|
|||||||
|
|
||||||
func (alloc *Allocator) handleHTTPAllocate(dockerCli *docker.Client, w http.ResponseWriter, ident string, checkAlive bool, subnet address.CIDR) {
|
func (alloc *Allocator) handleHTTPAllocate(dockerCli *docker.Client, w http.ResponseWriter, ident string, checkAlive bool, subnet address.CIDR) {
|
||||||
addr, err := alloc.Allocate(ident, subnet, checkAlive,
|
addr, err := alloc.Allocate(ident, subnet, checkAlive,
|
||||||
hasBeenCanceled(dockerCli, w.(http.CloseNotifier).CloseNotify(), ident, checkAlive))
|
hasBeenCancelled(dockerCli, w.(http.CloseNotifier).CloseNotify(), ident, checkAlive))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !cancellationErr(w, err) {
|
if !cancellationErr(w, err) {
|
||||||
badRequest(w, err)
|
badRequest(w, err)
|
||||||
@@ -74,7 +74,7 @@ func (alloc *Allocator) handleHTTPAllocate(dockerCli *docker.Client, w http.Resp
|
|||||||
|
|
||||||
func (alloc *Allocator) handleHTTPClaim(dockerCli *docker.Client, w http.ResponseWriter, ident string, cidr address.CIDR, checkAlive, noErrorOnUnknown bool) {
|
func (alloc *Allocator) handleHTTPClaim(dockerCli *docker.Client, w http.ResponseWriter, ident string, cidr address.CIDR, checkAlive, noErrorOnUnknown bool) {
|
||||||
err := alloc.Claim(ident, cidr, checkAlive, noErrorOnUnknown,
|
err := alloc.Claim(ident, cidr, checkAlive, noErrorOnUnknown,
|
||||||
hasBeenCanceled(dockerCli, w.(http.CloseNotifier).CloseNotify(), ident, checkAlive))
|
hasBeenCancelled(dockerCli, w.(http.CloseNotifier).CloseNotify(), ident, checkAlive))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !cancellationErr(w, err) {
|
if !cancellationErr(w, err) {
|
||||||
badRequest(w, fmt.Errorf("Unable to claim: %s", err))
|
badRequest(w, fmt.Errorf("Unable to claim: %s", err))
|
||||||
|
|||||||
Reference in new issue
Block a user