Skip to content

Commit 21e317c

Browse files
committed
portfwdserver: fix half-close
Fix issue 3685 Similar to 3684 Signed-off-by: Akihiro Suda <[email protected]>
1 parent d877648 commit 21e317c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/portfwdserver/server.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
package portfwdserver
55

66
import (
7+
"context"
78
"errors"
89
"io"
910
"net"
1011
"time"
1112

12-
"github.com/lima-vm/lima/pkg/bicopy"
13+
"github.com/containers/gvisor-tap-vsock/pkg/tcpproxy"
14+
1315
"github.com/lima-vm/lima/pkg/guestagent/api"
1416
)
1517

@@ -35,7 +37,10 @@ func (s *TunnelServer) Start(stream api.GuestService_TunnelServer) error {
3537
return err
3638
}
3739
rw := &GRPCServerRW{stream: stream, id: in.Id}
38-
bicopy.Bicopy(rw, conn, nil)
40+
proxy := tcpproxy.DialProxy{DialContext: func(_ context.Context, _, _ string) (net.Conn, error) {
41+
return conn, nil
42+
}}
43+
proxy.HandleConn(rw)
3944
return nil
4045
}
4146

0 commit comments

Comments
 (0)