sandbox: simplify if condition
@@ -79,7 +79,10 @@ func (s *Server) getSandboxIP(sb *sandbox.Sandbox) (string, error) {
// networkStop cleans up and removes a pod's network. It is best-effort and
// must call the network plugin even if the network namespace is already gone
func (s *Server) networkStop(sb *sandbox.Sandbox) {
- if !sb.HostNetwork() {
+ if sb.HostNetwork() {
+ return
+ }
+
if err := s.hostportManager.Remove(sb.ID(), &hostport.PodPortMapping{
Name: sb.Name(),
PortMappings: sb.PortMappings(),
@@ -95,4 +98,3 @@ func (s *Server) networkStop(sb *sandbox.Sandbox) {
sb.Name(), sb.ID(), err)
}
}
-}
