Merge pull request #542 from runcom/port-forward-panic
[e2e fix] server: fix PortForward panic
This commit is contained in:
commit
988f29fae8
2 changed files with 8 additions and 2 deletions
|
@ -26,8 +26,8 @@ func (s *Server) PortForward(ctx context.Context, req *pb.PortForwardRequest) (*
|
|||
return resp, nil
|
||||
}
|
||||
|
||||
func (ss streamService) PortForward(podInfraContainerID string, port int32, stream io.ReadWriteCloser) error {
|
||||
c := ss.runtimeServer.state.containers.Get(podInfraContainerID)
|
||||
func (ss streamService) PortForward(podSandboxID string, port int32, stream io.ReadWriteCloser) error {
|
||||
c := ss.runtimeServer.GetSandboxContainer(podSandboxID)
|
||||
|
||||
if err := ss.runtimeServer.runtime.UpdateStatus(c); err != nil {
|
||||
return err
|
||||
|
|
|
@ -672,6 +672,12 @@ func (s *Server) getContainer(id string) *oci.Container {
|
|||
return c
|
||||
}
|
||||
|
||||
// GetSandboxContainer returns the infra container for a given sandbox
|
||||
func (s *Server) GetSandboxContainer(id string) *oci.Container {
|
||||
sb := s.getSandbox(id)
|
||||
return sb.infraContainer
|
||||
}
|
||||
|
||||
func (s *Server) removeContainer(c *oci.Container) {
|
||||
s.stateLock.Lock()
|
||||
sandbox := s.state.sandboxes[c.Sandbox()]
|
||||
|
|
Loading…
Reference in a new issue