提交 461849d7 编写于 作者: J jack.wxz 提交者: jia zhang

Use pipe instead of net.FileConn to read protobuf.

Signed-off-by: Njack.wxz <wangxiaozhe@linux.alibaba.com>
上级 a937ea0b
......@@ -208,15 +208,9 @@ func handleRequest(conn net.Conn, id int) {
func relaySignal(signalPipe *os.File, id int) {
defer signalPipe.Close()
conn, err := net.FileConn(signalPipe)
if err != nil {
return
}
defer conn.Close()
for {
req := &pb.AgentServiceRequest{}
if err := protoBufRead(conn, req); err != nil {
if err := protoBufRead(signalPipe, req); err != nil {
return
}
......
......@@ -9,7 +9,6 @@ import (
pb "github.com/opencontainers/runc/libenclave/proto"
"golang.org/x/sys/unix"
"io"
"net"
"os"
"strconv"
"syscall"
......@@ -79,7 +78,7 @@ func unstageFd(env string) {
}
}
func protoBufRead(conn net.Conn, unmarshaled interface{}) error {
func protoBufRead(conn io.Reader, unmarshaled interface{}) error {
var sz uint32
data := make([]byte, unsafe.Sizeof(sz))
_, err := conn.Read(data)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册