Share connection between curl requests#170
Conversation
|
I have some concerns about sharing the connection (CURL_LOCK_DATA_CONNECT) between the mainloop (poller) and the download thread. The documentation states: "It is not supported to share connections between multiple concurrent threads." I did place locking on the shared data including CURL_LOCK_DATA_CONNECT though. |
|
I think inter-thread connection sharing as it's implemented here should be okay. Maybe we should add |
Added. |
e84e3ec to
0f76f69
Compare
TSAN works by inserting instrumentation into compiled code to detect race conditions. We use glib from Debian in CI, meaning those libraries are not built with TSAN instrumentation, so memory accesses cannot be tracked. This leads to false positives. So suggesting to enable the sanitizer was not a good idea after all. I'll drop the commit. |
0f76f69 to
7a8e42e
Compare
7a8e42e to
33bd37a
Compare
|
I've changed the PR slightly:
|
33bd37a to
56feb22
Compare
ejoerns
left a comment
There was a problem hiding this comment.
Looks good to me overall. Just a few notes left about possible enhancements I see.
Using a curl_share between curl requests allows sharing an open connection and re-use cached DNS, PSL and TLS session id. This change allows performing multiple requests without having to do re-perform the (full) TLS handshake. For reference, on a stm32mp151c with OPTEE + pkcs11 TA a full TLS handshake takes ~8 seconds. Mostly due to small pager pool (internal sram) available for OPTEE. With this change a mTLS curl request take around 60ms after the initial connection has been established. Signed-off-by: Robin van der Gracht <robin@protonic.nl> Signed-off-by: Bastian Krause <bst@pengutronix.de>
56feb22 to
dfe8ffd
Compare
Using a curl_share between curl requests allows sharing an open connection and re-use cached DNS, PSL and TLS session id.
This change allows performing multiple requests without having to do re-perform the (full) TLS handshake.
For reference, on a stm32mp151c with OPTEE + pkcs11 TA a full TLS handshake takes ~8 seconds. Mostly due to small pager pool (internal sram) available for OPTEE.
With this change a mTLS curl request take around 60ms after the initial connection has been established.