add peer ids to return

This commit is contained in:
boneyard93501 2023-04-24 14:25:48 -05:00
parent e40bf179d1
commit b9f05bdb1f

View File

@ -23,18 +23,21 @@ func put(file_name: string, file_content: []u8) -> PutResult, string, string:
res <- UrlDownloader.put(file_name, file_content) res <- UrlDownloader.put(file_name, file_content)
<- res, w.metadata.peer_id, w.metadata.relay_id! <- res, w.metadata.peer_id, w.metadata.relay_id!
func get_without_ids(file_name: string) -> []u8: func get_without_ids(file_name: string) -> []u8, []string:
result: *[]u8 result: *[]u8
peers: *string
workers <- getWorkers() workers <- getWorkers()
for w <- workers par: for w <- workers par:
on w.metadata.peer_id via w.metadata.relay_id: on w.metadata.peer_id via w.metadata.relay_id:
res <- UrlDownloader.get(file_name) res <- UrlDownloader.get(file_name)
if res.stderr == "": if res.stderr == "":
result <<- res.stdout result <<- res.stdout
peers <<- w.metadata.peer_id
peers <<- w.metadata.relay_id!
-- result <<- res.stdout -- result <<- res.stdout
join result[workers.length - 1] join result[workers.length - 1]
par Peer.timeout(10000, "Finding file timed out.") par Peer.timeout(10000, "Finding file timed out.")
<- result! <- result!, peers
func get_with_ids(file_name: string, peer_id: string, relay_id: string) -> GetResult: func get_with_ids(file_name: string, peer_id: string, relay_id: string) -> GetResult:
on peer_id via relay_id: on peer_id via relay_id: