From 777d564ca467245eb3ef294caaaaa736bc7b06ac Mon Sep 17 00:00:00 2001 From: erinn Date: Tue, 2 Nov 2021 14:31:14 -0700 Subject: [PATCH] wip: file retries --- lib.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib.go b/lib.go index 437e1f0..c0cf511 100644 --- a/lib.go +++ b/lib.go @@ -713,13 +713,20 @@ func c_CheckDownloadStatus(profilePtr *C.char, profileLen C.int, fileKeyPtr *C.c func CheckDownloadStatus(profileOnion, fileKey string) { profile := application.GetPeer(profileOnion) - if path, exists := profile.GetAttribute(attr.GetLocalScope(fileKey)); exists { + if path, exists := profile.GetAttribute(attr.GetLocalScope(fmt.Sprintf("%s.complete", fileKey))); exists { eventHandler.Push(event.NewEvent(event.FileDownloaded, map[event.Field]string{ ProfileOnion: profileOnion, event.FileKey: fileKey, event.FilePath: path, event.TempFile: "", })) + } else if path, exists = profile.GetAttribute(attr.GetLocalScope(fmt.Sprintf("%s.path", fileKey))); exists { + eventHandler.Push(event.NewEvent(event.FileDownloadProgressUpdate, map[event.Field]string{ + ProfileOnion: profileOnion, + event.FileKey: fileKey, + event.Progress: ??, + event.FileSizeInChunks: ??, + })) } }