返回 DeepSeek-Reasonix
remote_server_stop.go
根目录 / desktop / remote_server_stop.go
1 package main
2
3 func (a *App) StopRemoteServer(hostID, workspace string) error {
4 op := a.beginRemoteWindowHostOperation(hostID)
5 return op.run(func(func() bool) error {
6 rt, err := a.remoteRT()
7 if err != nil {
8 return err
9 }
10 parked := a.parkRemoteTabsForServer(hostID, workspace, "serve_down", "Remote server stopped.")
11 if err := rt.StopServer(hostID, workspace); err != nil {
12 for _, tabID := range parked {
13 a.emitRemoteTabState(tabID, "connecting", "")
14 a.goRemoteTabSafe("remoteTabServe", func() { a.bootstrapRemoteTab(tabID, hostID, workspace) })
15 }
16 return err
17 }
18 // Stopping the service also tears down that workspace's loopback
19 // tunnel, so close the host's web window only when it is showing this
20 // workspace.
21 if a.remoteWindowWorkspace(hostID) == workspace {
22 a.closeRemoteWindowForHost(hostID)
23 }
24 return nil
25 })
26 }
27
27 lines GO