9p: call Close() on all sessions during shutdown

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Levi Neely 2026-04-14 19:50:27 +02:00
parent 70579db150
commit 7ab641b350
2 changed files with 14 additions and 0 deletions

View File

@ -1377,6 +1377,19 @@ func (s *Server) createSession(args []string) error {
return nil
}
// Shutdown kills all active sessions, triggering Close() on each core.
func (s *Server) Shutdown() {
s.mu.Lock()
ids := make([]string, 0, len(s.sessions))
for id := range s.sessions {
ids = append(ids, id)
}
s.mu.Unlock()
for _, id := range ids {
s.killSession(id)
}
}
func (s *Server) killSession(id string) {
s.mu.Lock()
sess := s.sessions[id]

View File

@ -160,6 +160,7 @@ func runServer(sockPath, pidPath string) {
<-sigChan
fmt.Println("shutting down")
srv.Shutdown()
if fuseCmd != nil {
exec.Command("fusermount", "-u", mnt).Run() //nolint:errcheck
fuseCmd.Wait() //nolint:errcheck