Skip to content

Commit

Permalink
Remove miniccc client if VM is no longer present
Browse files Browse the repository at this point in the history
  • Loading branch information
activeshadow committed Sep 11, 2023
1 parent eb0f874 commit b2d0da5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/miniccc/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ func mux(done chan struct{}) {
log.Warn("server connection lost: resetting client")

// server connection lost, so reset client
time.Sleep(5 * time.Second)
resetClient()
return
}
Expand Down
9 changes: 9 additions & 0 deletions internal/ron/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,15 @@ func (s *Server) responseHandler() {
for cin := range s.responses {
log.Debug("responseHandler: %v", cin.UUID)

s.clientLock.Lock()
_, ok := s.vms[cin.UUID]
s.clientLock.Unlock()

if !ok {
s.removeClient(cin.UUID)
continue
}

// update all the client fields
s.updateClient(cin)

Expand Down

0 comments on commit b2d0da5

Please sign in to comment.