Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Revert: client.go: HybridVSockDialer: Change Read EOT to recv peek
Browse files Browse the repository at this point in the history
This reverts commit f8e4ce8.

Revert changes as bring some instability to CI. After find
the root cause it will be merged again.

Fixes: #716

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
  • Loading branch information
jcvenegas committed Jan 24, 2020
1 parent 6cfb75d commit 660e61f
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions protocols/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ import (
"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"
Expand Down Expand Up @@ -409,19 +407,12 @@ func HybridVSockDialer(sock string, timeout time.Duration) (net.Conn, error) {
return nil, err
}

// 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)
if _, _, err = unix.Recvfrom(int(file.Fd()), eot, syscall.MSG_PEEK); err != nil {
conn.Close()
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()
}

return conn, nil
Expand Down

0 comments on commit 660e61f

Please sign in to comment.