Merge pull request #2285 from teawater/update_a

vendor: Update github.com/kata-containers/agent
This commit is contained in:
Peng Tao
2019-12-16 20:21:23 +08:00
committed by GitHub
3 changed files with 24 additions and 9 deletions

4
Gopkg.lock generated
View File

@@ -405,7 +405,7 @@
revision = "8cba5a8e5f2816f26f9dc34b8ea968279a5a76eb"
[[projects]]
digest = "1:903bfb87f41dc18a533d327b5b03fd2f562f34deafcbd0db93d4be3fa8d6099c"
digest = "1:6da9487ef0cc0cca3eeb1a24e3bb018ce2e07b7c2fc4d50975b54efdcc942118"
name = "github.com/kata-containers/agent"
packages = [
"pkg/types",
@@ -413,7 +413,7 @@
"protocols/grpc",
]
pruneopts = "NUT"
revision = "32c87e75c2e4c014961f104c3c59b87f2aee3384"
revision = "6182fa34c64ba6eb1b6028d8b6647a86844129c4"
[[projects]]
branch = "master"

View File

@@ -52,7 +52,7 @@
[[constraint]]
name = "github.com/kata-containers/agent"
revision = "32c87e75c2e4c014961f104c3c59b87f2aee3384"
revision = "6182fa34c64ba6eb1b6028d8b6647a86844129c4"
[[constraint]]
name = "github.com/containerd/cri-containerd"

View File

@@ -9,16 +9,19 @@ package client
import (
"context"
"fmt"
"io"
"net"
"net/url"
"strconv"
"strings"
"syscall"
"time"
"github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc"
"github.com/hashicorp/yamux"
"github.com/mdlayher/vsock"
opentracing "github.com/opentracing/opentracing-go"
"golang.org/x/sys/unix"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
grpcStatus "google.golang.org/grpc/status"
@@ -407,12 +410,24 @@ func HybridVSockDialer(sock string, timeout time.Duration) (net.Conn, error) {
return nil, err
}
// Read EOT (End of transmission) byte
eot := make([]byte, 32)
if _, err = conn.Read(eot); err != nil {
// Just close the connection, gRPC will dial again
// without errors
conn.Close()
// Receive the packet from the connection without removing it from
// the receive queue (MSG_PEEK), ensuring the connection is usable.
if uc, ok := conn.(*net.UnixConn); ok {
file, err := uc.File()
if err != nil {
conn.Close()
return nil, err
}
eot := make([]byte, 1)
n, _, err := unix.Recvfrom(int(file.Fd()), eot, syscall.MSG_PEEK)
file.Close()
if err != nil || n == 0 {
conn.Close()
if err == nil {
err = io.EOF
}
return nil, err
}
}
return conn, nil