mirror of
https://github.com/curl/curl.git
synced 2026-08-25 13:33:36 +03:00
multi: event based rework
Rework the event based handling of transfers and connections to be "localized" into a single source file with clearer dependencies. - add multi_ev.c and multi_ev.h - add docs/internal/MULTI-EV.md to explain the overall workings - only do event handling book keeping when the socket callback is set - add handling for "connection only" event tracking, when internal easy handles are used that are not really tied to a connection. Used in connection pool. - remove transfer member "last_poll" and connections "shutdown_poll" and keep all that internal to multi_ev.c - add CURL_TRC_M() for tracing of "multi" related things, including event handling and connection pool operations. Add new trace feature "multi" for trace config. multi traces will show exactly what is going on in regard to event handling. - multi: trace transfers "mstate" in every CURL_TRC_M() call - make internal trace buffer 2048 bytes and end the silliness with +n here -m there. Adjust test 1652 expectations of resulting length and input edge cases. - add trace feature "lib-ids" to perfix libcurl traces with transfer and connection ids. Useful for debugging libcurl applications. Closes #16308
This commit is contained in:
parent
886f5dea80
commit
cfc657a48d
24 changed files with 1305 additions and 764 deletions
|
|
@ -422,7 +422,7 @@ static int socket_close(struct Curl_easy *data, struct connectdata *conn,
|
|||
|
||||
if(use_callback && conn && conn->fclosesocket) {
|
||||
int rc;
|
||||
Curl_multi_closed(data, sock);
|
||||
Curl_multi_will_close(data, sock);
|
||||
Curl_set_in_callback(data, TRUE);
|
||||
rc = conn->fclosesocket(conn->closesocket_client, sock);
|
||||
Curl_set_in_callback(data, FALSE);
|
||||
|
|
@ -431,7 +431,7 @@ static int socket_close(struct Curl_easy *data, struct connectdata *conn,
|
|||
|
||||
if(conn)
|
||||
/* tell the multi-socket code about this */
|
||||
Curl_multi_closed(data, sock);
|
||||
Curl_multi_will_close(data, sock);
|
||||
|
||||
sclose(sock);
|
||||
|
||||
|
|
@ -997,7 +997,7 @@ static void cf_socket_close(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
struct cf_socket_ctx *ctx = cf->ctx;
|
||||
|
||||
if(ctx && CURL_SOCKET_BAD != ctx->sock) {
|
||||
CURL_TRC_CF(data, cf, "cf_socket_close(%" FMT_SOCKET_T ")", ctx->sock);
|
||||
CURL_TRC_CF(data, cf, "cf_socket_close, fd=%" FMT_SOCKET_T, ctx->sock);
|
||||
if(ctx->sock == cf->conn->sock[cf->sockindex])
|
||||
cf->conn->sock[cf->sockindex] = CURL_SOCKET_BAD;
|
||||
socket_close(data, cf->conn, !ctx->accepted, ctx->sock);
|
||||
|
|
@ -1019,7 +1019,7 @@ static CURLcode cf_socket_shutdown(struct Curl_cfilter *cf,
|
|||
if(cf->connected) {
|
||||
struct cf_socket_ctx *ctx = cf->ctx;
|
||||
|
||||
CURL_TRC_CF(data, cf, "cf_socket_shutdown(%" FMT_SOCKET_T ")", ctx->sock);
|
||||
CURL_TRC_CF(data, cf, "cf_socket_shutdown, fd=%" FMT_SOCKET_T, ctx->sock);
|
||||
/* On TCP, and when the socket looks well and non-blocking mode
|
||||
* can be enabled, receive dangling bytes before close to avoid
|
||||
* entering RST states unnecessarily. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue