9p: call Close() on all sessions during shutdown
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
70579db150
commit
7ab641b350
|
|
@ -1377,6 +1377,19 @@ func (s *Server) createSession(args []string) error {
|
||||||
return nil
|
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) {
|
func (s *Server) killSession(id string) {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
sess := s.sessions[id]
|
sess := s.sessions[id]
|
||||||
|
|
|
||||||
1
main.go
1
main.go
|
|
@ -160,6 +160,7 @@ func runServer(sockPath, pidPath string) {
|
||||||
<-sigChan
|
<-sigChan
|
||||||
|
|
||||||
fmt.Println("shutting down")
|
fmt.Println("shutting down")
|
||||||
|
srv.Shutdown()
|
||||||
if fuseCmd != nil {
|
if fuseCmd != nil {
|
||||||
exec.Command("fusermount", "-u", mnt).Run() //nolint:errcheck
|
exec.Command("fusermount", "-u", mnt).Run() //nolint:errcheck
|
||||||
fuseCmd.Wait() //nolint:errcheck
|
fuseCmd.Wait() //nolint:errcheck
|
||||||
|
|
|
||||||
Reference in New Issue