Log Errors related to Sharing Files

This commit is contained in:
Sarah Jamie Lewis 2023-01-05 11:21:08 -08:00
parent a698f34bfa
commit 697b3df54c
2 changed files with 9 additions and 1 deletions

View File

@ -115,6 +115,7 @@ func (f *Functionality) RestartFileShare(profile peer.CwtchPeer, filekey string)
manifest, manifestExists := profile.GetScopedZonedAttribute(attr.ConversationScope, attr.FilesharingZone, fmt.Sprintf("%s.manifest", filekey))
if manifestExists {
// everything is in order, so reshare this file with the engine
log.Debugf("restarting file share: %v", filekey)
profile.ShareFile(filekey, manifest)
return nil
}
@ -132,6 +133,7 @@ func (f *Functionality) ReShareFiles(profile peer.CwtchPeer) error {
for _, key := range keys {
// only look at timestamp keys
// this is an arbitrary choice
if strings.HasSuffix(key, ".ts") {
_, zonedpath := attr.ParseScope(key)
_, keypath := attr.ParseZone(zonedpath)
@ -148,7 +150,12 @@ func (f *Functionality) ReShareFiles(profile peer.CwtchPeer) error {
// Then attempt to share this file again...
// TODO: In the future this would be the point to change the timestamp and reshare the file...
if err == nil && sharedFile.Active {
f.RestartFileShare(profile, filekey)
err := f.RestartFileShare(profile, filekey)
if err != nil {
log.Errorf("could not reshare file: %v", err)
}
} else {
log.Errorf("could not get fileshare info %v", err)
}
}
}

View File

@ -34,6 +34,7 @@ func (fsss *FileSharingSubSystem) ShareFile(fileKey string, serializedManifest s
log.Errorf("could not share file %v", err)
return
}
log.Debugf("sharing file: %v %v", fileKey, serializedManifest)
fsss.activeShares.Store(fileKey, &manifest)
}