server: fix panic when listing sandboxes

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-09-27 10:40:08 +02:00
parent 56f2b34def
commit 4578cc93d1
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
2 changed files with 12 additions and 0 deletions

View file

@ -179,6 +179,12 @@ func (s *Server) hasSandbox(id string) bool {
return ok
}
func (s *Server) removeSandbox(id string) {
s.stateLock.Lock()
delete(s.state.sandboxes, id)
s.stateLock.Unlock()
}
func (s *Server) addContainer(c *oci.Container) {
s.stateLock.Lock()
sandbox := s.state.sandboxes[c.Sandbox()]