修复:审查发现的高优先问题(竞态/初始化/碰撞)
- app.go: profileSvc移入App struct,用a.mu保护 - sqlite.go: InitFast加sync.Once防并发双重初始化 - client.go: Manager.Connect加sync.Mutex防竞态泄漏SSH - service.go: 临时文件用os.CreateTemp防时间戳碰撞 - connection-manager: 密码缺失时不再塞入假WailsTransport
This commit is contained in:
11
app.go
11
app.go
@@ -38,6 +38,7 @@ type App struct {
|
||||
pdfAPI *api.PdfAPI
|
||||
filesystem *filesystem.FileSystemService
|
||||
sftpService *sftp.Service
|
||||
profileSvc *service.ProfileService
|
||||
isAlwaysOnTop bool
|
||||
mu sync.Mutex
|
||||
}
|
||||
@@ -986,13 +987,13 @@ type SaveProfileRequest struct {
|
||||
LastConnected *int64 `json:"last_connected"`
|
||||
}
|
||||
|
||||
var profileSvc *service.ProfileService
|
||||
|
||||
func (a *App) ensureProfileSvc() *service.ProfileService {
|
||||
if profileSvc == nil {
|
||||
profileSvc = service.NewProfileService()
|
||||
a.mu.Lock()
|
||||
defer a.mu.Unlock()
|
||||
if a.profileSvc == nil {
|
||||
a.profileSvc = service.NewProfileService()
|
||||
}
|
||||
return profileSvc
|
||||
return a.profileSvc
|
||||
}
|
||||
|
||||
func (a *App) LoadConnectionProfiles() ([]map[string]interface{}, error) {
|
||||
|
||||
Reference in New Issue
Block a user