Buy commercial curl support from WolfSSL. We help you work
out your issues, debug your libcurl applications, use the API, port to new
platforms, add new features and more. With a team lead by the curl founder
himself.
Re: conn.data considered bad
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Patrick Monnerat via curl-library <curl-library_at_cool.haxx.se>
Date: Sun, 10 Jan 2021 10:49:34 +0100
On 1/8/21 3:51 PM, Daniel Stenberg via curl-library wrote:
> Hi all,
>
> Here's something that's been itching in me for a long time. Something
> I've even (twice!) tried to fix. Both times my patch ended up so huge
> and complicated for me that I had to give it and postpone the idea.
>
> Put shortly: "conn->data considered bad". The association *from* a
> connection object to a transfer object is bad, because it is fragile
> and error-prone due to the fact that it can and will change very
> frequently for multiplexed transfers.
>
> A transfer can use one (or no) connection. A connection can have no,
> one or very many transfers associated with it.
>
> Conclusion: we should stop using 'conn->data' in libcurl
>
> Status: there are 939 current uses of this pointer
>
> Mission: reduce the use of this pointer, aiming to reach a point in
> the future when we can remove it from the connection struct.
Happy new year to everyone!
Considering the large number of references, I would suggest starting to
fix this "bottom up" by smaller commits rather than having a big patch,
even if it increases the reference count at first while the work is not
complete.
I also noticed there are a lot of references to conn->data for logging
purposes only (infof, failf, debug) in connection-oriented procedures:
maybe we should discuss an alternate strategy for logging from those
procedures.
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-01-10
Date: Sun, 10 Jan 2021 10:49:34 +0100
On 1/8/21 3:51 PM, Daniel Stenberg via curl-library wrote:
> Hi all,
>
> Here's something that's been itching in me for a long time. Something
> I've even (twice!) tried to fix. Both times my patch ended up so huge
> and complicated for me that I had to give it and postpone the idea.
>
> Put shortly: "conn->data considered bad". The association *from* a
> connection object to a transfer object is bad, because it is fragile
> and error-prone due to the fact that it can and will change very
> frequently for multiplexed transfers.
>
> A transfer can use one (or no) connection. A connection can have no,
> one or very many transfers associated with it.
>
> Conclusion: we should stop using 'conn->data' in libcurl
>
> Status: there are 939 current uses of this pointer
>
> Mission: reduce the use of this pointer, aiming to reach a point in
> the future when we can remove it from the connection struct.
Happy new year to everyone!
Considering the large number of references, I would suggest starting to
fix this "bottom up" by smaller commits rather than having a big patch,
even if it increases the reference count at first while the work is not
complete.
I also noticed there are a lot of references to conn->data for logging
purposes only (infof, failf, debug) in connection-oriented procedures:
maybe we should discuss an alternate strategy for logging from those
procedures.
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-01-10