From d0cceac68f953434d67f95ac9c7ca7ff16df7d31 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 8 Jan 2021 17:58:15 +0100 Subject: lib: pass in 'struct Curl_easy *' to most functions ... in most cases instead of 'struct connectdata *' but in some cases in addition to. - We mostly operate on transfers and not connections. - We need the transfer handle to log, store data and more. Everything in libcurl is driven by a transfer (the CURL * in the public API). - This work clarifies and separates the transfers from the connections better. - We should avoid "conn->data". Since individual connections can be used by many transfers when multiplexing, making sure that conn->data points to the current and correct transfer at all times is difficult and has been notoriously error-prone over the years. The goal is to ultimately remove the conn->data pointer for this reason. Closes #6425 --- lib/vtls/mesalink.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/vtls/mesalink.c') diff --git a/lib/vtls/mesalink.c b/lib/vtls/mesalink.c index 309786cf8..93e3381cf 100644 --- a/lib/vtls/mesalink.c +++ b/lib/vtls/mesalink.c @@ -6,7 +6,7 @@ * \___|\___/|_| \_\_____| * * Copyright (C) 2017 - 2018, Yiming Jing, - * Copyright (C) 1998 - 2020, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2021, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -378,9 +378,10 @@ mesalink_connect_step3(struct connectdata *conn, int sockindex) } static ssize_t -mesalink_send(struct connectdata *conn, int sockindex, const void *mem, +mesalink_send(struct Curl_easy *data, int sockindex, const void *mem, size_t len, CURLcode *curlcode) { + struct connectdata *conn = data->conn; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; char error_buffer[MESALINK_MAX_ERROR_SZ]; int memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len; @@ -395,7 +396,7 @@ mesalink_send(struct connectdata *conn, int sockindex, const void *mem, *curlcode = CURLE_AGAIN; return -1; default: - failf(conn->data, + failf(data, "SSL write: %s, errno %d", ERR_error_string_n(err, error_buffer, sizeof(error_buffer)), SOCKERRNO); @@ -423,9 +424,10 @@ Curl_mesalink_close(struct connectdata *conn, int sockindex) } static ssize_t -mesalink_recv(struct connectdata *conn, int num, char *buf, size_t buffersize, +mesalink_recv(struct Curl_easy *data, int num, char *buf, size_t buffersize, CURLcode *curlcode) { + struct connectdata *conn = data->conn; struct ssl_connect_data *connssl = &conn->ssl[num]; char error_buffer[MESALINK_MAX_ERROR_SZ]; int buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize; @@ -444,7 +446,7 @@ mesalink_recv(struct connectdata *conn, int num, char *buf, size_t buffersize, *curlcode = CURLE_AGAIN; return -1; default: - failf(conn->data, + failf(data, "SSL read: %s, errno %d", ERR_error_string_n(err, error_buffer, sizeof(error_buffer)), SOCKERRNO); -- cgit v1.2.1