edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
From: Adam Thompson <arthompson1990@gmail.com>
To: Chris Brannon <chris@the-brannons.com>
Cc: Edbrowse-dev@lists.the-brannons.com
Subject: Re: [Edbrowse-dev] curl handles and general comms design
Date: Fri, 8 Jan 2016 19:43:01 +0000	[thread overview]
Message-ID: <20160108194301.GJ12402@122oven.adamthompson.me.uk> (raw)
In-Reply-To: <8760z8c12v.fsf@mushroom.localdomain>

[-- Attachment #1: Type: text/plain, Size: 2134 bytes --]

On Mon, Jan 04, 2016 at 04:38:32PM -0800, Chris Brannon wrote:
> Adam Thompson <arthompson1990@gmail.com> writes:
> 
> > To solve the parallel curl handles accessing cookie databases issue,
> > there's also the curl-shared interface.
> > I believe this can be used with the curl-multi interface since the curl-multi
> > interface is single-threaded so no need for mutexes etc.
> 
> We're using that now, but with curl easy handles, rather than curl
> multi.  I don't know what would be involved in moving over to curl multi.

I think curl multi is another object like curl shared,
so I *think* an easy handle can be in a shared and multi object at the same
time, though I'm really not sure.

> > What this all means I think is that, by combining both interfaces,
> > we should be able to create a single-threaded, essentially async, comms layer.
> 
> The one problem is that you cannot share persistent connections across
> curl easy handles.
> 
> Basically, you create a curl multi handle, and then add curl easy
> handles to it.  So when would we create the individual curl easy
> handles?

Ok, so I'm thinking of something like the following high level approach:
Keep the global curl shared object, but not the global curl easy handle.
The share object will be set for each new curl easy handle.
We create a global curl multi object and have logic to keep checking this for
active transfers and if any are found run the next chunk of the transfer.
For each transfer we add a curl easy handle to the multi object, and have logic to remove it when the transfer is finished.

If I understand things correctly the shared object should keep track of the
cookies whilst the multi object handles the connections and provides a way of
managing the connections so that the handles can be added when we need them.
We may need some way to get the cookies into and out of curl,
but I'm not sure of the cleanist way to do this.
I'm surprised there isn't a way to get the shared object to write the cookie
file on clean up but if not then we can always keep the global curl easy handle.

Regards,
Adam.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

      reply	other threads:[~2016-01-08 19:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-29 19:17 Adam Thompson
2015-12-29 19:57 ` Karl Dahlke
2015-12-29 22:27   ` Chris Brannon
2015-12-30 12:01   ` Adam Thompson
2015-12-30 12:26     ` Karl Dahlke
2015-12-30 13:22       ` Adam Thompson
2015-12-30 13:41         ` Karl Dahlke
2016-01-05  0:38 ` Chris Brannon
2016-01-08 19:43   ` Adam Thompson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160108194301.GJ12402@122oven.adamthompson.me.uk \
    --to=arthompson1990@gmail.com \
    --cc=Edbrowse-dev@lists.the-brannons.com \
    --cc=chris@the-brannons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).