Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETWORKING: Enter Session and SessionRequest #1914

merged 4 commits into from Nov 5, 2019


Copy link

Tkachov commented Nov 3, 2019

Originally intended to be a speedup for libcurl by reusing the same handle in keep-alive connections. Turns out, libcurl automatically does that.

Anyways, this PR does some useful edits in backends/networking/curl and adds SessionRequest, which might be not only used asynchronously as before (via callbacks), but also synchronously using wait(). Session class allows to reuse these SessionRequests.

Tkachov added 4 commits Nov 1, 2019
It is to be used in a Session, though it might be used separately. It
must implement keep-alive, but it does not yet.

You must not put it to ConnMan by yourself (instead, use start()) and
you must call close() after you've finished using this request.

You can either work with it in callback, or wait() and simply use its
methods (check it's success() and then, for example, use text()). Like
Networking::SessionRequest *rq = new Networking::SessionRequest(url);
if (rq->success())
warning("HTTP GET: %s", rq->text());
Session allows to reuse SessionRequests to the same host by making them
keeping alive connection. Turns out, though, that libcurl already does
that for us, and we didn't gain any speedup we thought we'd get.

Networking::Session s;
Networking::SessionRequest *request = s.get(url);
warning("HTTP GET: %s", request->text());

You can still use SessionRequest without Session (but you can't put them
on stack!):
Networking::SessionRequest *request = new
warning("HTTP GET: %s", request->text());
@Tkachov Tkachov force-pushed the Tkachov:keep-alive branch from e3b83fb to e8b4645 Nov 4, 2019

This comment has been minimized.

Copy link

sev- commented Nov 5, 2019

Thanks! Merging

@sev- sev- merged commit 99e21f4 into scummvm:master Nov 5, 2019
1 of 2 checks passed
1 of 2 checks passed
Codacy/PR Quality Review Not up to standards. This pull request quality could be better.
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.