返回 DeepSeek-Reasonix
remote_tab_resume_failure.go
根目录 / desktop / remote_tab_resume_failure.go
1 package main
2
3 import (
4 "fmt"
5 "net/http"
6 )
7
8 // A rejection is one publication transaction: observers of its error must
9 // already see the restored identity. The route fence also prevents a newer
10 // selection or authoritative frame from being overwritten by the old failure.
11 func (a *App) completeRemoteTabResumeFailure(tabID string, tab *remoteTab, client *http.Client, gen uint64, route remoteTabProvisionalResume, message string) bool {
12 tab.routeEventMu.Lock()
13 defer tab.routeEventMu.Unlock()
14 a.remoteTabMu.Lock()
15 current := a.remoteTabs[tabID]
16 if current != tab || current.client != client || current.gen != gen || current.state != "ready" ||
17 current.selectionRevision != route.selectionRevision || current.routing.currentPath != route.targetPath ||
18 route.active && (current.routing.rehydratingPath != route.targetPath || current.routing.pathRevision != route.pathRevision+1) ||
19 !route.active && current.routing.pathRevision != route.pathRevision ||
20 route.previousSelection != nil && current.selectionRevision != route.previousSelection.revision {
21 a.remoteTabMu.Unlock()
22 return true
23 }
24 if route.previousSelection != nil {
25 restoreRemoteTabOpenSelectionLocked(current, route.previousSelection)
26 } else if route.active {
27 restoreRemoteTabProvisionalRouteLocked(current, route)
28 }
29 current.err = message
30 meta := remoteTabMetaLocked(current)
31 a.remoteTabMu.Unlock()
32 if route.previousSelection != nil {
33 a.emitRemoteEvent("remote-tab:updated", meta)
34 a.saveTabsFromRemote()
35 }
36 a.emitRemoteEvent(fmt.Sprintf("remote-tab:%s:state", tabID), RemoteTabStateView{State: "ready", Error: message})
37 return false
38 }
39
39 lines GO