curl / Mailing Lists / curl-library / Single Mail
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: Concurrency and send/recv

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 13 Mar 2021 01:20:45 -0500

On 3/12/2021 11:45 PM, Jacob Hoffman-Andrews via curl-library wrote:
> Currently the rustls backend uses a buffer on the stack for its `send`
> / `recv` implementations. I'd like to switch this to be a
> heap-allocated buffer, initialized once and stored in the
> `connssl->backend` struct. Is it guaranteed that `send` and `recv` are
> never called concurrently? In general what are the concurrency
> properties that apply to TLS backends?

curl handles can't be used from multiple threads at the same time [1]
and because of that I'm pretty sure it's not possible. Note cached
connections can be shared between threads (but there is a concurrency
bug in that). Daniel will have to elaborate on the intentions here but
I'm pretty sure based on the way it's documented [2] that it's not possible.

[1]: https://curl.se/libcurl/c/threadsafe.html
[2]: https://curl.se/libcurl/c/curl_share_setopt.html


-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html
Received on 2021-03-13