2025-07-22 15:48 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004617Spring engineGeneralpublic2016-01-19 19:37
Reporterabma 
Assigned Togajop 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0004617: pr-downloader api
Descriptionfor async:
http://en.cppreference.com/w/cpp/thread/async

for comm:

std::future

https://solarianprogrammer.com/2012/10/17/cpp-11-async-tutorial/
Additional Informationuse namespaces!

(03:18:02) [LCC]jK: std::future
(03:18:26) [LCC]jK: The template function async runs the function f asynchronously (potentially in a separate thread) and returns a std::future that will eventually hold the result of that function call.
(03:19:25) [LCC]jK: so the lua function first returns the result of DownloadSearch()
(03:20:14) [LCC]jK: and later lua calls a Spring....IsFinished() that checks if the std::future is ready and if so it returns the result
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0013821

abma (administrator)

Add a callin when download fails, with a reason why
    Make it async and add a callin when it succeeds
    Add callouts to stop, pause and list existing downloads with name, start time, progress (current bytes, total bytes), short name, current download speed and ETA (whatever prdownloader can provide)

~0013945

abma (administrator)

Last edited: 2015-01-26 14:49

View 3 revisions

unassigned because i'm not actively working on it atm. to busy with other, also important stuff :-|

proof of concept works:

https://github.com/spring/spring/tree/pr-downloader


note: gajop said he will continue this (not sure if thats still valid)

~0013946

gajop (developer)

Yep, I'm working on it.
It's going a bit slow because I'm also learning how engine does callins.

I've got this so far:
https://github.com/gajop/spring/commit/c0e562771f9df9ef95eca8d06904fdcf91f8a5c0
https://github.com/gajop/pr-downloader/commit/01f1505a5153199fcbf7ab664389a97dbee861ff

It's kinda ugly, especially the pr-downloader part, but I'm just trying to get stuff working and I'll clean it up later.
The main issue now is that I shouldn't be calling the event handler (and thus lua handler) from multiple threads (at the same time), but (according to jk) rather rely on the eventbatchhandler to queue up the events.

There's still a bit of work to go before I ask for design/code comments and any pull requests can be made.

~0013947

jK (developer)

why callins at all?

~0013948

gajop (developer)

For the following things I think it's obvious why callins would be needed:
- DownloadStarted (confirms that the provided game/map and its dependencies exists and their download has started)
- DownloadFailed
- DownloadFinished

The only alternative would be to poll it on Update in the widget which seems really wrong. Spring.HasDownloadFinished ? -> no
DownloadQueued is used to obtain a surrogate key instead of using the name+version combination in all other callins.

For DownloadProgress it might make sense to consider polling instead, but I don't really see the benefit of that over the callin approach. With the callin we could better specify the update step (i.e. how often updates should be reported), and it should only be invoked when there's actually been a change.

~0015182

abma (administrator)

https://github.com/spring/spring/pull/221

~0015543

gajop (developer)

the branch has been merged; future work should go to separate PRs/issues
+Notes

-Issue History
Date Modified Username Field Change
2014-11-13 03:13 abma New Issue
2014-11-13 03:13 abma Status new => assigned
2014-11-13 03:13 abma Assigned To => abma
2014-11-13 03:16 abma Description Updated View Revisions
2014-11-13 03:17 abma Additional Information Updated View Revisions
2014-11-13 03:18 abma Additional Information Updated View Revisions
2014-11-13 03:18 abma Additional Information Updated View Revisions
2014-11-13 03:20 abma Note Added: 0013821
2015-01-03 04:20 abma Target Version 99.0 =>
2015-01-26 14:31 abma Assigned To abma =>
2015-01-26 14:32 abma Status assigned => new
2015-01-26 14:32 abma Note Added: 0013945
2015-01-26 14:33 abma Note Edited: 0013945 View Revisions
2015-01-26 14:49 abma Note Edited: 0013945 View Revisions
2015-01-26 15:25 gajop Note Added: 0013946
2015-01-27 06:54 jK Note Added: 0013947
2015-01-27 07:07 gajop Note Added: 0013948
2015-09-16 23:51 abma Note Added: 0015182
2016-01-19 19:37 gajop Note Added: 0015543
2016-01-19 19:37 gajop Status new => closed
2016-01-19 19:37 gajop Assigned To => gajop
2016-01-19 19:37 gajop Resolution open => fixed
+Issue History